Category: Matlab
Category Archives: Matlab
Hi, why am I getting an error?
it gives me an error on the plot function. The error message is:
Error using LinearModel/plot
Wrong number of arguments.
load (‘DATI_PAZ1’);
LV_1=LV;
lat_1=lat;
sept_1=sept;
time_1=time;
load (‘DATI_PAZ2’);
LV_2=LV;
lat_2=lat;
ant_2=ant;
time_2=time;
figure
plot(time_1,LV_1,’k’)
hold on
plot(time_1,lat_1,’b’)
hold on
plot(time_1,sept_1,’r’)
grid on
xlabel(‘time [s]’),ylabel(‘colpi/(s*voxel)’)
title(‘Conc. FDG – CASO I’)
legend(‘ventr.sx’,’laterale’,’setto’)
figure
plot(time_2,LV_2,’k’)
hold on
plot(time_2,lat_2,’b’)
hold on
plot(time_2,ant_2,’r’)
grid on
xlabel(‘time [s]’),ylabel(‘colpi/(s*voxel)’)
title(‘Conc. FDG – CASO II’)
legend(‘ventr.sx’,’laterale’,’anteriore’)
y_lat_1=lat_1./LV_1;
y_sept_1=sept_1./LV_1;
x_1=cumtrapz(time_1,LV_1)./LV_1;
figure
subplot(1,2,1)
plot(x_1,y_lat_1,’*b’)
hold on
plot(x_1,y_sept_1,’*r’)
title(‘Patlak graph – CASO I’)
F_sept_1=fitlm(x_1(18:24,1),y_sept_1(18:24,1),’poly1′);
hold on
plot(F_sept_1,’r’) %error
F_lat_1=fitlm(x_1(18:24,1),y_lat_1(18:24,1),’poly1′);
hold on
plot(F_lat_1,’b’) %error
legend(‘parete laterale’,’setto’)
xlabel(‘trapz( C_p(t) dt)/C_p(t) [s]’),ylabel(‘C_t(t)/C_p(t) [adimensionale]’)
m_setto_1=F_sept_1.p1;
m_laterale_1=F_lat_1.p1;it gives me an error on the plot function. The error message is:
Error using LinearModel/plot
Wrong number of arguments.
load (‘DATI_PAZ1’);
LV_1=LV;
lat_1=lat;
sept_1=sept;
time_1=time;
load (‘DATI_PAZ2’);
LV_2=LV;
lat_2=lat;
ant_2=ant;
time_2=time;
figure
plot(time_1,LV_1,’k’)
hold on
plot(time_1,lat_1,’b’)
hold on
plot(time_1,sept_1,’r’)
grid on
xlabel(‘time [s]’),ylabel(‘colpi/(s*voxel)’)
title(‘Conc. FDG – CASO I’)
legend(‘ventr.sx’,’laterale’,’setto’)
figure
plot(time_2,LV_2,’k’)
hold on
plot(time_2,lat_2,’b’)
hold on
plot(time_2,ant_2,’r’)
grid on
xlabel(‘time [s]’),ylabel(‘colpi/(s*voxel)’)
title(‘Conc. FDG – CASO II’)
legend(‘ventr.sx’,’laterale’,’anteriore’)
y_lat_1=lat_1./LV_1;
y_sept_1=sept_1./LV_1;
x_1=cumtrapz(time_1,LV_1)./LV_1;
figure
subplot(1,2,1)
plot(x_1,y_lat_1,’*b’)
hold on
plot(x_1,y_sept_1,’*r’)
title(‘Patlak graph – CASO I’)
F_sept_1=fitlm(x_1(18:24,1),y_sept_1(18:24,1),’poly1′);
hold on
plot(F_sept_1,’r’) %error
F_lat_1=fitlm(x_1(18:24,1),y_lat_1(18:24,1),’poly1′);
hold on
plot(F_lat_1,’b’) %error
legend(‘parete laterale’,’setto’)
xlabel(‘trapz( C_p(t) dt)/C_p(t) [s]’),ylabel(‘C_t(t)/C_p(t) [adimensionale]’)
m_setto_1=F_sept_1.p1;
m_laterale_1=F_lat_1.p1; it gives me an error on the plot function. The error message is:
Error using LinearModel/plot
Wrong number of arguments.
load (‘DATI_PAZ1’);
LV_1=LV;
lat_1=lat;
sept_1=sept;
time_1=time;
load (‘DATI_PAZ2’);
LV_2=LV;
lat_2=lat;
ant_2=ant;
time_2=time;
figure
plot(time_1,LV_1,’k’)
hold on
plot(time_1,lat_1,’b’)
hold on
plot(time_1,sept_1,’r’)
grid on
xlabel(‘time [s]’),ylabel(‘colpi/(s*voxel)’)
title(‘Conc. FDG – CASO I’)
legend(‘ventr.sx’,’laterale’,’setto’)
figure
plot(time_2,LV_2,’k’)
hold on
plot(time_2,lat_2,’b’)
hold on
plot(time_2,ant_2,’r’)
grid on
xlabel(‘time [s]’),ylabel(‘colpi/(s*voxel)’)
title(‘Conc. FDG – CASO II’)
legend(‘ventr.sx’,’laterale’,’anteriore’)
y_lat_1=lat_1./LV_1;
y_sept_1=sept_1./LV_1;
x_1=cumtrapz(time_1,LV_1)./LV_1;
figure
subplot(1,2,1)
plot(x_1,y_lat_1,’*b’)
hold on
plot(x_1,y_sept_1,’*r’)
title(‘Patlak graph – CASO I’)
F_sept_1=fitlm(x_1(18:24,1),y_sept_1(18:24,1),’poly1′);
hold on
plot(F_sept_1,’r’) %error
F_lat_1=fitlm(x_1(18:24,1),y_lat_1(18:24,1),’poly1′);
hold on
plot(F_lat_1,’b’) %error
legend(‘parete laterale’,’setto’)
xlabel(‘trapz( C_p(t) dt)/C_p(t) [s]’),ylabel(‘C_t(t)/C_p(t) [adimensionale]’)
m_setto_1=F_sept_1.p1;
m_laterale_1=F_lat_1.p1; error using linearmodel/plot, wrong number of arguments MATLAB Answers — New Questions
After performing stereo calibration using a checkerboard, the same checkerboard is reconstructed in 3D. I have several questions regarding the results.
Currently, I am facing three issues related to 3D reconstruction. As shown in the first attached image, I describe the x-axis as positive to the right and the y-axis as positive upwards (since the checkerboard is planar, I will not consider the z-axis in this question). The green plots mean the ground truth, and the red plots mean reconstructed values in the first attached image.
When considering the detected checkerboard corner points in the same x×y layout as the premise, the ground truth is detected and plotted as 8×11, while the reconstructed values are detected and plotted as 10×7. Why is there a difference of one cell in the detected grid? Please refer to the attached checkerboard image for this situation.
As seen in the attached image, the long side of the ground truth checkerboard is aligned along the y-axis direction, while the long side of the reconstructed checkerboard appears to be aligned along the x-axis direction. Why does it seem like the long side’s position has rotated during reconstruction?
The first detected corner point of the reconstructed values should be located at the same origin as the first detected corner point of the ground truth, but it is located in a different position. What is the cause of this? Is this due to low accuracy in the camera parameters, or is it because the reconstructed values and the ground truth are represented in different coordinate systems? Could there be other reasons for this?
The specific causes for the second and third questions might be the same, but I appreciate your response. For reference, I am attaching the code as well.
% Loading stereo images
I1 = imread(‘/Users/uchidataisei/dev/uchida/kenkyu_data/2024-06-14/C3/GX010541_frames/frame0052.png’); % 左画像
I2 = imread(‘/Users/uchidataisei/dev/uchida/kenkyu_data/2024-06-14/C2/GX010611_frames/frame0052.png’); % 右画像
% Using pre-obtained calibration parameters
load(‘/Users/uchidataisei/dev/uchida/MATLAB_data/2024_06_14/calibrationSession_0614_C3_2_.mat’);
% Rectification
% [J1, J2, reprojectionMatrix] = rectifyStereoImages(I1, I2, stereoParams_0614_C3_2);
[J1, J2, reprojectionMatrix] = rectifyStereoImages(I1, I2, stereoParams_0614_C3_2_);
% Calculating the disparity map
disparityMap = disparitySGM(rgb2gray(J1), rgb2gray(J2));
% Reconstructing the 3D scene
points3D = reconstructScene(disparityMap, reprojectionMatrix);
% Setting the ground truth of the checkerboard, [mm]
squareSize = 114;
% Detecting the corners of the checkerboard
[imagePoints, boardSize] = detectCheckerboardPoints(J1);
% Calculating the ground truth grid of the checkerboard
[worldX, worldY] = meshgrid(0:squareSize:((boardSize(1)-1)*squareSize), 0:squareSize:((boardSize(2)-1)*squareSize));
worldPoints = [worldX(:), worldY(:), zeros(numel(worldX), 1)]; % Z=0
% Matching the number of detected corners with the number of ground truth points
% if size(worldPoints, 1) > size(imagePoints, 1)
% worldPoints = worldPoints(1:size(imagePoints, 1), :);
% elseif size(worldPoints, 1) < size(imagePoints, 1)
% error(‘The number of ground truth points is less than the number of detected corners. Please check the number of ground truth points.’);
% end
% Extracting the 3D points of the reconstructed checkerboard corners
detected3DPoints = zeros(size(imagePoints, 1), 3);
validIndices = true(size(imagePoints, 1), 1);
for i = 1:size(imagePoints, 1)
x = round(imagePoints(i, 1));
y = round(imagePoints(i, 2));
if x > 0 && y > 0 && x <= size(points3D, 2) && y <= size(points3D, 1)
detected3DPoints(i, 🙂 = points3D(y, x, :);
if any(isnan(detected3DPoints(i, :)) | isinf(detected3DPoints(i, :)))
validIndices(i) = false;
end
else
validIndices(i) = false;
end
end
% Excluding invalid points
% detected3DPoints = detected3DPoints(validIndices, :); %Reconstructed grid
% worldPoints = worldPoints(validIndices, :); %Ground truth grid
% Omitting scale transformation
detected3DPoints_mm = detected3DPoints;
% Comparison of ground truth and reconstructed results
figure;
plot3(worldPoints(:,1), worldPoints(:,2), worldPoints(:,3), ‘go’);
hold on;
plot3(detected3DPoints_mm(:,1), detected3DPoints_mm(:,2), detected3DPoints_mm(:,3), ‘rx’);
% Displaying numbers on each plot
for i = 1:size(worldPoints, 1)
text(worldPoints(i, 1), worldPoints(i, 2), worldPoints(i, 3), num2str(i), ‘Color’, ‘green’);
text(detected3DPoints_mm(i, 1), detected3DPoints_mm(i, 2), detected3DPoints_mm(i, 3), num2str(i), ‘Color’, ‘red’);
end
legend(‘True Points’, ‘Reconstructed Points’);
xlabel(‘X (mm)’);
ylabel(‘Y (mm)’);
zlabel(‘Z (mm)’);
title(‘Comparison of True and Reconstructed Points’);
grid on;
% Calculating the error
errors_xy = sqrt(sum((worldPoints(:, 1:2) – detected3DPoints_mm(:, 1:2)).^2, 2));
meanError_xy = mean(errors_xy);
disp([‘Mean Error in XY plane: ‘, num2str(meanError_xy), ‘ millimeters’]);Currently, I am facing three issues related to 3D reconstruction. As shown in the first attached image, I describe the x-axis as positive to the right and the y-axis as positive upwards (since the checkerboard is planar, I will not consider the z-axis in this question). The green plots mean the ground truth, and the red plots mean reconstructed values in the first attached image.
When considering the detected checkerboard corner points in the same x×y layout as the premise, the ground truth is detected and plotted as 8×11, while the reconstructed values are detected and plotted as 10×7. Why is there a difference of one cell in the detected grid? Please refer to the attached checkerboard image for this situation.
As seen in the attached image, the long side of the ground truth checkerboard is aligned along the y-axis direction, while the long side of the reconstructed checkerboard appears to be aligned along the x-axis direction. Why does it seem like the long side’s position has rotated during reconstruction?
The first detected corner point of the reconstructed values should be located at the same origin as the first detected corner point of the ground truth, but it is located in a different position. What is the cause of this? Is this due to low accuracy in the camera parameters, or is it because the reconstructed values and the ground truth are represented in different coordinate systems? Could there be other reasons for this?
The specific causes for the second and third questions might be the same, but I appreciate your response. For reference, I am attaching the code as well.
% Loading stereo images
I1 = imread(‘/Users/uchidataisei/dev/uchida/kenkyu_data/2024-06-14/C3/GX010541_frames/frame0052.png’); % 左画像
I2 = imread(‘/Users/uchidataisei/dev/uchida/kenkyu_data/2024-06-14/C2/GX010611_frames/frame0052.png’); % 右画像
% Using pre-obtained calibration parameters
load(‘/Users/uchidataisei/dev/uchida/MATLAB_data/2024_06_14/calibrationSession_0614_C3_2_.mat’);
% Rectification
% [J1, J2, reprojectionMatrix] = rectifyStereoImages(I1, I2, stereoParams_0614_C3_2);
[J1, J2, reprojectionMatrix] = rectifyStereoImages(I1, I2, stereoParams_0614_C3_2_);
% Calculating the disparity map
disparityMap = disparitySGM(rgb2gray(J1), rgb2gray(J2));
% Reconstructing the 3D scene
points3D = reconstructScene(disparityMap, reprojectionMatrix);
% Setting the ground truth of the checkerboard, [mm]
squareSize = 114;
% Detecting the corners of the checkerboard
[imagePoints, boardSize] = detectCheckerboardPoints(J1);
% Calculating the ground truth grid of the checkerboard
[worldX, worldY] = meshgrid(0:squareSize:((boardSize(1)-1)*squareSize), 0:squareSize:((boardSize(2)-1)*squareSize));
worldPoints = [worldX(:), worldY(:), zeros(numel(worldX), 1)]; % Z=0
% Matching the number of detected corners with the number of ground truth points
% if size(worldPoints, 1) > size(imagePoints, 1)
% worldPoints = worldPoints(1:size(imagePoints, 1), :);
% elseif size(worldPoints, 1) < size(imagePoints, 1)
% error(‘The number of ground truth points is less than the number of detected corners. Please check the number of ground truth points.’);
% end
% Extracting the 3D points of the reconstructed checkerboard corners
detected3DPoints = zeros(size(imagePoints, 1), 3);
validIndices = true(size(imagePoints, 1), 1);
for i = 1:size(imagePoints, 1)
x = round(imagePoints(i, 1));
y = round(imagePoints(i, 2));
if x > 0 && y > 0 && x <= size(points3D, 2) && y <= size(points3D, 1)
detected3DPoints(i, 🙂 = points3D(y, x, :);
if any(isnan(detected3DPoints(i, :)) | isinf(detected3DPoints(i, :)))
validIndices(i) = false;
end
else
validIndices(i) = false;
end
end
% Excluding invalid points
% detected3DPoints = detected3DPoints(validIndices, :); %Reconstructed grid
% worldPoints = worldPoints(validIndices, :); %Ground truth grid
% Omitting scale transformation
detected3DPoints_mm = detected3DPoints;
% Comparison of ground truth and reconstructed results
figure;
plot3(worldPoints(:,1), worldPoints(:,2), worldPoints(:,3), ‘go’);
hold on;
plot3(detected3DPoints_mm(:,1), detected3DPoints_mm(:,2), detected3DPoints_mm(:,3), ‘rx’);
% Displaying numbers on each plot
for i = 1:size(worldPoints, 1)
text(worldPoints(i, 1), worldPoints(i, 2), worldPoints(i, 3), num2str(i), ‘Color’, ‘green’);
text(detected3DPoints_mm(i, 1), detected3DPoints_mm(i, 2), detected3DPoints_mm(i, 3), num2str(i), ‘Color’, ‘red’);
end
legend(‘True Points’, ‘Reconstructed Points’);
xlabel(‘X (mm)’);
ylabel(‘Y (mm)’);
zlabel(‘Z (mm)’);
title(‘Comparison of True and Reconstructed Points’);
grid on;
% Calculating the error
errors_xy = sqrt(sum((worldPoints(:, 1:2) – detected3DPoints_mm(:, 1:2)).^2, 2));
meanError_xy = mean(errors_xy);
disp([‘Mean Error in XY plane: ‘, num2str(meanError_xy), ‘ millimeters’]); Currently, I am facing three issues related to 3D reconstruction. As shown in the first attached image, I describe the x-axis as positive to the right and the y-axis as positive upwards (since the checkerboard is planar, I will not consider the z-axis in this question). The green plots mean the ground truth, and the red plots mean reconstructed values in the first attached image.
When considering the detected checkerboard corner points in the same x×y layout as the premise, the ground truth is detected and plotted as 8×11, while the reconstructed values are detected and plotted as 10×7. Why is there a difference of one cell in the detected grid? Please refer to the attached checkerboard image for this situation.
As seen in the attached image, the long side of the ground truth checkerboard is aligned along the y-axis direction, while the long side of the reconstructed checkerboard appears to be aligned along the x-axis direction. Why does it seem like the long side’s position has rotated during reconstruction?
The first detected corner point of the reconstructed values should be located at the same origin as the first detected corner point of the ground truth, but it is located in a different position. What is the cause of this? Is this due to low accuracy in the camera parameters, or is it because the reconstructed values and the ground truth are represented in different coordinate systems? Could there be other reasons for this?
The specific causes for the second and third questions might be the same, but I appreciate your response. For reference, I am attaching the code as well.
% Loading stereo images
I1 = imread(‘/Users/uchidataisei/dev/uchida/kenkyu_data/2024-06-14/C3/GX010541_frames/frame0052.png’); % 左画像
I2 = imread(‘/Users/uchidataisei/dev/uchida/kenkyu_data/2024-06-14/C2/GX010611_frames/frame0052.png’); % 右画像
% Using pre-obtained calibration parameters
load(‘/Users/uchidataisei/dev/uchida/MATLAB_data/2024_06_14/calibrationSession_0614_C3_2_.mat’);
% Rectification
% [J1, J2, reprojectionMatrix] = rectifyStereoImages(I1, I2, stereoParams_0614_C3_2);
[J1, J2, reprojectionMatrix] = rectifyStereoImages(I1, I2, stereoParams_0614_C3_2_);
% Calculating the disparity map
disparityMap = disparitySGM(rgb2gray(J1), rgb2gray(J2));
% Reconstructing the 3D scene
points3D = reconstructScene(disparityMap, reprojectionMatrix);
% Setting the ground truth of the checkerboard, [mm]
squareSize = 114;
% Detecting the corners of the checkerboard
[imagePoints, boardSize] = detectCheckerboardPoints(J1);
% Calculating the ground truth grid of the checkerboard
[worldX, worldY] = meshgrid(0:squareSize:((boardSize(1)-1)*squareSize), 0:squareSize:((boardSize(2)-1)*squareSize));
worldPoints = [worldX(:), worldY(:), zeros(numel(worldX), 1)]; % Z=0
% Matching the number of detected corners with the number of ground truth points
% if size(worldPoints, 1) > size(imagePoints, 1)
% worldPoints = worldPoints(1:size(imagePoints, 1), :);
% elseif size(worldPoints, 1) < size(imagePoints, 1)
% error(‘The number of ground truth points is less than the number of detected corners. Please check the number of ground truth points.’);
% end
% Extracting the 3D points of the reconstructed checkerboard corners
detected3DPoints = zeros(size(imagePoints, 1), 3);
validIndices = true(size(imagePoints, 1), 1);
for i = 1:size(imagePoints, 1)
x = round(imagePoints(i, 1));
y = round(imagePoints(i, 2));
if x > 0 && y > 0 && x <= size(points3D, 2) && y <= size(points3D, 1)
detected3DPoints(i, 🙂 = points3D(y, x, :);
if any(isnan(detected3DPoints(i, :)) | isinf(detected3DPoints(i, :)))
validIndices(i) = false;
end
else
validIndices(i) = false;
end
end
% Excluding invalid points
% detected3DPoints = detected3DPoints(validIndices, :); %Reconstructed grid
% worldPoints = worldPoints(validIndices, :); %Ground truth grid
% Omitting scale transformation
detected3DPoints_mm = detected3DPoints;
% Comparison of ground truth and reconstructed results
figure;
plot3(worldPoints(:,1), worldPoints(:,2), worldPoints(:,3), ‘go’);
hold on;
plot3(detected3DPoints_mm(:,1), detected3DPoints_mm(:,2), detected3DPoints_mm(:,3), ‘rx’);
% Displaying numbers on each plot
for i = 1:size(worldPoints, 1)
text(worldPoints(i, 1), worldPoints(i, 2), worldPoints(i, 3), num2str(i), ‘Color’, ‘green’);
text(detected3DPoints_mm(i, 1), detected3DPoints_mm(i, 2), detected3DPoints_mm(i, 3), num2str(i), ‘Color’, ‘red’);
end
legend(‘True Points’, ‘Reconstructed Points’);
xlabel(‘X (mm)’);
ylabel(‘Y (mm)’);
zlabel(‘Z (mm)’);
title(‘Comparison of True and Reconstructed Points’);
grid on;
% Calculating the error
errors_xy = sqrt(sum((worldPoints(:, 1:2) – detected3DPoints_mm(:, 1:2)).^2, 2));
meanError_xy = mean(errors_xy);
disp([‘Mean Error in XY plane: ‘, num2str(meanError_xy), ‘ millimeters’]); #reconstructscene, stereoparameters, detectcheckerboardpoints, 3d reconstruction MATLAB Answers — New Questions
Fill confidence band hexadecimal color
Hello!
I am plotting a confidence band using fill, and get an error-message when using hecadecimal color:
I have tried with both ‘Color’ and ‘FaceColor’ before the hexadecimal color, without it helping. It works when I use a default color such as ‘b’.
Also, when trying just to plot the line (not filling), it works with the html-code.
fill([0:hmax, fliplr(0:hmax)], [upper_bounds, fliplr(lower_bounds)], ‘#7E2F8E’, ‘FaceAlpha’, 0.2, ‘EdgeColor’, ‘none’);
Thanks!Hello!
I am plotting a confidence band using fill, and get an error-message when using hecadecimal color:
I have tried with both ‘Color’ and ‘FaceColor’ before the hexadecimal color, without it helping. It works when I use a default color such as ‘b’.
Also, when trying just to plot the line (not filling), it works with the html-code.
fill([0:hmax, fliplr(0:hmax)], [upper_bounds, fliplr(lower_bounds)], ‘#7E2F8E’, ‘FaceAlpha’, 0.2, ‘EdgeColor’, ‘none’);
Thanks! Hello!
I am plotting a confidence band using fill, and get an error-message when using hecadecimal color:
I have tried with both ‘Color’ and ‘FaceColor’ before the hexadecimal color, without it helping. It works when I use a default color such as ‘b’.
Also, when trying just to plot the line (not filling), it works with the html-code.
fill([0:hmax, fliplr(0:hmax)], [upper_bounds, fliplr(lower_bounds)], ‘#7E2F8E’, ‘FaceAlpha’, 0.2, ‘EdgeColor’, ‘none’);
Thanks! #plot #fill #hexadecimal #confidenceband MATLAB Answers — New Questions
Working with modified code -2024A
I am working with a slightly modified version of ode113. Until I was using the same code I copied and pasted and modified a few versions ago. Now in 2024A I got an error message, so I copied the code of ode113 again into a new file and modified again. However, a new problem has risen- it seems that 2023 is dependant on private functions, and I am now getting "unrecognized function or variable" errors. A workaround that I found is copying all the relevant private folders into a new folder. Is that the best way to solve the issue?
many thanks
NathanI am working with a slightly modified version of ode113. Until I was using the same code I copied and pasted and modified a few versions ago. Now in 2024A I got an error message, so I copied the code of ode113 again into a new file and modified again. However, a new problem has risen- it seems that 2023 is dependant on private functions, and I am now getting "unrecognized function or variable" errors. A workaround that I found is copying all the relevant private folders into a new folder. Is that the best way to solve the issue?
many thanks
Nathan I am working with a slightly modified version of ode113. Until I was using the same code I copied and pasted and modified a few versions ago. Now in 2024A I got an error message, so I copied the code of ode113 again into a new file and modified again. However, a new problem has risen- it seems that 2023 is dependant on private functions, and I am now getting "unrecognized function or variable" errors. A workaround that I found is copying all the relevant private folders into a new folder. Is that the best way to solve the issue?
many thanks
Nathan private, private functions, modified MATLAB Answers — New Questions
Why is this matlab program not able to solve accurately?
B=[E_b*I_b*(-beta^3*cos(beta*l)-beta^3*cosh(beta*l))+m2*omega^2*(sin(beta*l)-sinh(beta*l)),E_b*I_b*(beta^3*sin(beta*l)-beta^3*sinh(beta*l))+m2*omega^2*(cos(beta*l)-cosh(beta*l));
E_b*I_b*(-beta^2*sin(beta*l)-beta^2*sinh(beta*l))-J*omega^2*(sin(beta*l)-sinh(beta*l)),E_b*I_b*(-beta^2*cos(beta*l)-beta^2*cosh(beta*l))-J*omega^2*(cos(beta*l)-cosh(beta*l)) ]B=[E_b*I_b*(-beta^3*cos(beta*l)-beta^3*cosh(beta*l))+m2*omega^2*(sin(beta*l)-sinh(beta*l)),E_b*I_b*(beta^3*sin(beta*l)-beta^3*sinh(beta*l))+m2*omega^2*(cos(beta*l)-cosh(beta*l));
E_b*I_b*(-beta^2*sin(beta*l)-beta^2*sinh(beta*l))-J*omega^2*(sin(beta*l)-sinh(beta*l)),E_b*I_b*(-beta^2*cos(beta*l)-beta^2*cosh(beta*l))-J*omega^2*(cos(beta*l)-cosh(beta*l)) ] B=[E_b*I_b*(-beta^3*cos(beta*l)-beta^3*cosh(beta*l))+m2*omega^2*(sin(beta*l)-sinh(beta*l)),E_b*I_b*(beta^3*sin(beta*l)-beta^3*sinh(beta*l))+m2*omega^2*(cos(beta*l)-cosh(beta*l));
E_b*I_b*(-beta^2*sin(beta*l)-beta^2*sinh(beta*l))-J*omega^2*(sin(beta*l)-sinh(beta*l)),E_b*I_b*(-beta^2*cos(beta*l)-beta^2*cosh(beta*l))-J*omega^2*(cos(beta*l)-cosh(beta*l)) ] solve the determinant MATLAB Answers — New Questions
Training agent in reinforcement learning: reproducibility of the code
I get two different results from running this water-tank system example for reinforcement learning made by Mathworks:
https://uk.mathworks.com/help/reinforcement-learning/ug/create-simulink-environment-and-train-agent.html
This example has fixed the random number generator seed rng(0), so I expected the result to be the same on all computer. However, I ended up with two different agents on two computers:
Computer A finished training the agent after 86 episodes (just like the published example) and gave me an identical agent to the example.
Computer B needed 182 episodes to train the agent and gave me a different agent.
Both computers run MATLAB R2023b 64-bit on MS Windows 10. The code is unchanged from the example (except for changing doTraining = false to doTraining = true).
Computer A has an 8-core i7 processor. Computer B has a 6-core i7 processor.
I’m writing a tutorial for a univeristy-level course, so reproducibility is necessary so that students can follow the example. Any tip on how to facilitate this is also much appreciated.I get two different results from running this water-tank system example for reinforcement learning made by Mathworks:
https://uk.mathworks.com/help/reinforcement-learning/ug/create-simulink-environment-and-train-agent.html
This example has fixed the random number generator seed rng(0), so I expected the result to be the same on all computer. However, I ended up with two different agents on two computers:
Computer A finished training the agent after 86 episodes (just like the published example) and gave me an identical agent to the example.
Computer B needed 182 episodes to train the agent and gave me a different agent.
Both computers run MATLAB R2023b 64-bit on MS Windows 10. The code is unchanged from the example (except for changing doTraining = false to doTraining = true).
Computer A has an 8-core i7 processor. Computer B has a 6-core i7 processor.
I’m writing a tutorial for a univeristy-level course, so reproducibility is necessary so that students can follow the example. Any tip on how to facilitate this is also much appreciated. I get two different results from running this water-tank system example for reinforcement learning made by Mathworks:
https://uk.mathworks.com/help/reinforcement-learning/ug/create-simulink-environment-and-train-agent.html
This example has fixed the random number generator seed rng(0), so I expected the result to be the same on all computer. However, I ended up with two different agents on two computers:
Computer A finished training the agent after 86 episodes (just like the published example) and gave me an identical agent to the example.
Computer B needed 182 episodes to train the agent and gave me a different agent.
Both computers run MATLAB R2023b 64-bit on MS Windows 10. The code is unchanged from the example (except for changing doTraining = false to doTraining = true).
Computer A has an 8-core i7 processor. Computer B has a 6-core i7 processor.
I’m writing a tutorial for a univeristy-level course, so reproducibility is necessary so that students can follow the example. Any tip on how to facilitate this is also much appreciated. reinforcement learning, agent, training, random number generator MATLAB Answers — New Questions
Colormap a plot based on value of (x,y)
Hello,
I have a table T of dimensions x,y where each point has a value between -100 and 100.
I want to graph this data such that T(1,1) is point 1,1 on the graph and the color of that point is determined by the value of T(1,1)
I included a picture of something similar to what I want my plot to look like, along with some code that generates an example table for graphing
Thanks in advance for any help you can provide.
clear
clc
close all
%This will generate a table with example data.
x=100
y=50
data=zeros(y,x);
data(1,1)=50;
dchartdx=25/x;
dchartdy=25/y;
for ii=1:x
data(1,ii+1)=data(1,ii)+dchartdx;
end
for ii=1:x+1
for ij=1:y
data(ij+1,ii)=data(ij,ii)+dchartdy;
end
endHello,
I have a table T of dimensions x,y where each point has a value between -100 and 100.
I want to graph this data such that T(1,1) is point 1,1 on the graph and the color of that point is determined by the value of T(1,1)
I included a picture of something similar to what I want my plot to look like, along with some code that generates an example table for graphing
Thanks in advance for any help you can provide.
clear
clc
close all
%This will generate a table with example data.
x=100
y=50
data=zeros(y,x);
data(1,1)=50;
dchartdx=25/x;
dchartdy=25/y;
for ii=1:x
data(1,ii+1)=data(1,ii)+dchartdx;
end
for ii=1:x+1
for ij=1:y
data(ij+1,ii)=data(ij,ii)+dchartdy;
end
end Hello,
I have a table T of dimensions x,y where each point has a value between -100 and 100.
I want to graph this data such that T(1,1) is point 1,1 on the graph and the color of that point is determined by the value of T(1,1)
I included a picture of something similar to what I want my plot to look like, along with some code that generates an example table for graphing
Thanks in advance for any help you can provide.
clear
clc
close all
%This will generate a table with example data.
x=100
y=50
data=zeros(y,x);
data(1,1)=50;
dchartdx=25/x;
dchartdy=25/y;
for ii=1:x
data(1,ii+1)=data(1,ii)+dchartdx;
end
for ii=1:x+1
for ij=1:y
data(ij+1,ii)=data(ij,ii)+dchartdy;
end
end colormap plot MATLAB Answers — New Questions
i am working on Image Compression Using Run Length Encoding
am getting error in scanning in zigzag
the error is as follows
Undefined function or variable ‘toZigzag’.
Error in rlc_haar (line 21)
ImageArray=toZigzag(QuantizedImage);
plese help me
%% Matlab code for Image Compression Using Run Length Encoding
clc;
clear;
close all;
%% Set Quantization Parameter
quantizedvalue=10;
%% Read Input Image
InputImage=imread(‘cameraman.tif’);
[row col p]=size(InputImage);
%% Wavelet Decomposition
[LL LH HL HH]=dwt2(InputImage,’haar’);
WaveletDecomposeImage=[LL,LH;HL,HH];
imshow(WaveletDecomposeImage,[]);
%uniform quantization
QuantizedImage= WaveletDecomposeImage/quantizedvalue;
QuantizedImage= round(QuantizedImage);
% Convert the Two dimensional Image to a one dimensional Array using ZigZag Scanning
ImageArray=toZigzag(QuantizedImage);
%% Run Length Encoding
j=1;
a=length(ImageArray);
count=0;
for n=1:a
b=ImageArray(n);
if n==a
count=count+1;
c(j)=count;
s(j)=ImageArray(n);
elseif ImageArray(n)==ImageArray(n+1)
count=count+1;
elseif ImageArray(n)==b
count=count+1;
c(j)=count;
s(j)=ImageArray(n);
j=j+1;
count=0;
end
end
%% Calculation Bit Cost
InputBitcost=row*col*8;
InputBitcost=(InputBitcost);
c1=length(c);
s1=length(s);
OutputBitcost= (c1*8)+(s1*8);
OutputBitcost=(OutputBitcost);
%% Run Length Decoding g=length(s);
j=1;
l=1;
for i=1:g
v(l)=s(j);
if c(j)~=0
w=l+c(j)-1;
for p=l:w
v(l)=s(j);
l=l+1;
end
end
j=j+1;
end
ReconstructedImageArray=v;
%% Inverse ZigZag
ReconstructedImage=invZigzag(ReconstructedImageArray)
%% Inverse Quantization
ReconstructedImage=ReconstructedImage*quantizedvalue;am getting error in scanning in zigzag
the error is as follows
Undefined function or variable ‘toZigzag’.
Error in rlc_haar (line 21)
ImageArray=toZigzag(QuantizedImage);
plese help me
%% Matlab code for Image Compression Using Run Length Encoding
clc;
clear;
close all;
%% Set Quantization Parameter
quantizedvalue=10;
%% Read Input Image
InputImage=imread(‘cameraman.tif’);
[row col p]=size(InputImage);
%% Wavelet Decomposition
[LL LH HL HH]=dwt2(InputImage,’haar’);
WaveletDecomposeImage=[LL,LH;HL,HH];
imshow(WaveletDecomposeImage,[]);
%uniform quantization
QuantizedImage= WaveletDecomposeImage/quantizedvalue;
QuantizedImage= round(QuantizedImage);
% Convert the Two dimensional Image to a one dimensional Array using ZigZag Scanning
ImageArray=toZigzag(QuantizedImage);
%% Run Length Encoding
j=1;
a=length(ImageArray);
count=0;
for n=1:a
b=ImageArray(n);
if n==a
count=count+1;
c(j)=count;
s(j)=ImageArray(n);
elseif ImageArray(n)==ImageArray(n+1)
count=count+1;
elseif ImageArray(n)==b
count=count+1;
c(j)=count;
s(j)=ImageArray(n);
j=j+1;
count=0;
end
end
%% Calculation Bit Cost
InputBitcost=row*col*8;
InputBitcost=(InputBitcost);
c1=length(c);
s1=length(s);
OutputBitcost= (c1*8)+(s1*8);
OutputBitcost=(OutputBitcost);
%% Run Length Decoding g=length(s);
j=1;
l=1;
for i=1:g
v(l)=s(j);
if c(j)~=0
w=l+c(j)-1;
for p=l:w
v(l)=s(j);
l=l+1;
end
end
j=j+1;
end
ReconstructedImageArray=v;
%% Inverse ZigZag
ReconstructedImage=invZigzag(ReconstructedImageArray)
%% Inverse Quantization
ReconstructedImage=ReconstructedImage*quantizedvalue; am getting error in scanning in zigzag
the error is as follows
Undefined function or variable ‘toZigzag’.
Error in rlc_haar (line 21)
ImageArray=toZigzag(QuantizedImage);
plese help me
%% Matlab code for Image Compression Using Run Length Encoding
clc;
clear;
close all;
%% Set Quantization Parameter
quantizedvalue=10;
%% Read Input Image
InputImage=imread(‘cameraman.tif’);
[row col p]=size(InputImage);
%% Wavelet Decomposition
[LL LH HL HH]=dwt2(InputImage,’haar’);
WaveletDecomposeImage=[LL,LH;HL,HH];
imshow(WaveletDecomposeImage,[]);
%uniform quantization
QuantizedImage= WaveletDecomposeImage/quantizedvalue;
QuantizedImage= round(QuantizedImage);
% Convert the Two dimensional Image to a one dimensional Array using ZigZag Scanning
ImageArray=toZigzag(QuantizedImage);
%% Run Length Encoding
j=1;
a=length(ImageArray);
count=0;
for n=1:a
b=ImageArray(n);
if n==a
count=count+1;
c(j)=count;
s(j)=ImageArray(n);
elseif ImageArray(n)==ImageArray(n+1)
count=count+1;
elseif ImageArray(n)==b
count=count+1;
c(j)=count;
s(j)=ImageArray(n);
j=j+1;
count=0;
end
end
%% Calculation Bit Cost
InputBitcost=row*col*8;
InputBitcost=(InputBitcost);
c1=length(c);
s1=length(s);
OutputBitcost= (c1*8)+(s1*8);
OutputBitcost=(OutputBitcost);
%% Run Length Decoding g=length(s);
j=1;
l=1;
for i=1:g
v(l)=s(j);
if c(j)~=0
w=l+c(j)-1;
for p=l:w
v(l)=s(j);
l=l+1;
end
end
j=j+1;
end
ReconstructedImageArray=v;
%% Inverse ZigZag
ReconstructedImage=invZigzag(ReconstructedImageArray)
%% Inverse Quantization
ReconstructedImage=ReconstructedImage*quantizedvalue; . MATLAB Answers — New Questions
Mex-file not being found for Data Translation hardware
Hey everyone,
i recently move from MATLAB R2023b to MATLAB R2024a and must reinstall some package again.
So i reinstall Data Acquisition Toolbox and Data Acquisition Support Package for Data Translation to pursue a project i’m working on.
Everything was working fine on the previous MATLAB version but now for any try to acquire a signal for example, i receive the following error message:
‘The required MEX file to communicate with Data Translation hardware could not be loaded.
The attempt gave the Error ID of MATLAB:mex:ErrInvalidMEXFile and the message
Invalid MEX-file ‘C:Users"Username"AppDataRoamingMathWorksMATLAB Add-OnsToolboxesData Acquisition Toolbox Support Package for Data Translation Hardwareadaptorwin64mexOldaApi.mexw64′: Das angegebene Modul wurde nicht gefunden.’
reads the indicated modul ist not found. But this file mexOldaApi.mexw64 is precisely there.
I checked the vendors available and found out that ‘dt’ is set as not to be operational although the drivers are installed in MATLAB and both MATLAB and the computer have been reset.
Thanks for your suggestions to fix this.
Best regards,
GalvaniHey everyone,
i recently move from MATLAB R2023b to MATLAB R2024a and must reinstall some package again.
So i reinstall Data Acquisition Toolbox and Data Acquisition Support Package for Data Translation to pursue a project i’m working on.
Everything was working fine on the previous MATLAB version but now for any try to acquire a signal for example, i receive the following error message:
‘The required MEX file to communicate with Data Translation hardware could not be loaded.
The attempt gave the Error ID of MATLAB:mex:ErrInvalidMEXFile and the message
Invalid MEX-file ‘C:Users"Username"AppDataRoamingMathWorksMATLAB Add-OnsToolboxesData Acquisition Toolbox Support Package for Data Translation Hardwareadaptorwin64mexOldaApi.mexw64′: Das angegebene Modul wurde nicht gefunden.’
reads the indicated modul ist not found. But this file mexOldaApi.mexw64 is precisely there.
I checked the vendors available and found out that ‘dt’ is set as not to be operational although the drivers are installed in MATLAB and both MATLAB and the computer have been reset.
Thanks for your suggestions to fix this.
Best regards,
Galvani Hey everyone,
i recently move from MATLAB R2023b to MATLAB R2024a and must reinstall some package again.
So i reinstall Data Acquisition Toolbox and Data Acquisition Support Package for Data Translation to pursue a project i’m working on.
Everything was working fine on the previous MATLAB version but now for any try to acquire a signal for example, i receive the following error message:
‘The required MEX file to communicate with Data Translation hardware could not be loaded.
The attempt gave the Error ID of MATLAB:mex:ErrInvalidMEXFile and the message
Invalid MEX-file ‘C:Users"Username"AppDataRoamingMathWorksMATLAB Add-OnsToolboxesData Acquisition Toolbox Support Package for Data Translation Hardwareadaptorwin64mexOldaApi.mexw64′: Das angegebene Modul wurde nicht gefunden.’
reads the indicated modul ist not found. But this file mexOldaApi.mexw64 is precisely there.
I checked the vendors available and found out that ‘dt’ is set as not to be operational although the drivers are installed in MATLAB and both MATLAB and the computer have been reset.
Thanks for your suggestions to fix this.
Best regards,
Galvani dt_package_mexfile MATLAB Answers — New Questions
Removing outliers from the data creates gaps. Filling these gaps with missing values or the median of surrounding values does not address the issue.Why?
I am analyzing EMG data in windows. In each window, I apply z-score normalization to identify and remove outliers. To address the gaps created by removing these outliers, I attempt to fill the empty spaces with the median of the surrounding values. Additionally, I have experimented with MATLAB built-in functions such as ‘movmedian’ for this purpose.
here is my function:
function data_clean = remove_outliers_and_fill(data)
% Calculate z-scores for each column
z_scores = zscore(data);
% Define outlier threshold
threshold =3;
% Identify outliers
outliers = abs(z_scores) > threshold;
% Copy data to preserve original shape
data_clean = data;
% Loop through each column
[num_rows, num_cols] = size(data);
for col = 1:num_cols
for row = 1:num_rows
if outliers(row, col)
range_start = max(1, row-10);
range_end = min(num_rows, row+10);
neighbors = data(range_start:range_end, col);
% Exclude the outlier from median calculation
filtered_neighbors = neighbors(neighbors ~= data(row, col));
median_value = median(filtered_neighbors);
data_clean(row, col) = median_value;
end
end
end
end
here is the plot where it creates gaps after applying the above function.I am analyzing EMG data in windows. In each window, I apply z-score normalization to identify and remove outliers. To address the gaps created by removing these outliers, I attempt to fill the empty spaces with the median of the surrounding values. Additionally, I have experimented with MATLAB built-in functions such as ‘movmedian’ for this purpose.
here is my function:
function data_clean = remove_outliers_and_fill(data)
% Calculate z-scores for each column
z_scores = zscore(data);
% Define outlier threshold
threshold =3;
% Identify outliers
outliers = abs(z_scores) > threshold;
% Copy data to preserve original shape
data_clean = data;
% Loop through each column
[num_rows, num_cols] = size(data);
for col = 1:num_cols
for row = 1:num_rows
if outliers(row, col)
range_start = max(1, row-10);
range_end = min(num_rows, row+10);
neighbors = data(range_start:range_end, col);
% Exclude the outlier from median calculation
filtered_neighbors = neighbors(neighbors ~= data(row, col));
median_value = median(filtered_neighbors);
data_clean(row, col) = median_value;
end
end
end
end
here is the plot where it creates gaps after applying the above function. I am analyzing EMG data in windows. In each window, I apply z-score normalization to identify and remove outliers. To address the gaps created by removing these outliers, I attempt to fill the empty spaces with the median of the surrounding values. Additionally, I have experimented with MATLAB built-in functions such as ‘movmedian’ for this purpose.
here is my function:
function data_clean = remove_outliers_and_fill(data)
% Calculate z-scores for each column
z_scores = zscore(data);
% Define outlier threshold
threshold =3;
% Identify outliers
outliers = abs(z_scores) > threshold;
% Copy data to preserve original shape
data_clean = data;
% Loop through each column
[num_rows, num_cols] = size(data);
for col = 1:num_cols
for row = 1:num_rows
if outliers(row, col)
range_start = max(1, row-10);
range_end = min(num_rows, row+10);
neighbors = data(range_start:range_end, col);
% Exclude the outlier from median calculation
filtered_neighbors = neighbors(neighbors ~= data(row, col));
median_value = median(filtered_neighbors);
data_clean(row, col) = median_value;
end
end
end
end
here is the plot where it creates gaps after applying the above function. outliers, matlab function, emg signal MATLAB Answers — New Questions
How can i change the font size of XTick and YTick (x axis and y axis) in histogram of a image?
I have a image as lena.jpg, from which i was trying to obtain hist graph.
x=imread(‘lena.jpg’);
imhist(x);
set(gca,’FontSize’,15);
with this code i am able to change the font size of YTick only but i want to change font size of both. how can i do that????I have a image as lena.jpg, from which i was trying to obtain hist graph.
x=imread(‘lena.jpg’);
imhist(x);
set(gca,’FontSize’,15);
with this code i am able to change the font size of YTick only but i want to change font size of both. how can i do that???? I have a image as lena.jpg, from which i was trying to obtain hist graph.
x=imread(‘lena.jpg’);
imhist(x);
set(gca,’FontSize’,15);
with this code i am able to change the font size of YTick only but i want to change font size of both. how can i do that???? image processing, matlab, histogram MATLAB Answers — New Questions
how to output capacity degradation curve based on simscape battery (table-based) block
I am using simscape battery toolbox for battery calendar aging simulation, with the battery table-based block, I enable the calendar aging function, I think which means my cell capacity now will decrease with the time
but I cannot find any port to output or somewhere to allow me to extract the battery capacity data. So I want to know, if I run a 100 weeks calendar aging simulation, and I want to obtain the capacity degradation curve (like the figure below, here I choose a cycle aging as an example, the axle x is the cycle life or time, the axle y is the remaining capacity)
how could I extract the battery capacity information from the Battery (table-based) block, if someone can help me, I will be very grateful, thanks.
(By the way, I have reviewed the help document regarding Battery (table-based) and Simscape battery, I also check the video "simscape battery essentials part 1 to 7" on Youtube, but cannot find the solution.)I am using simscape battery toolbox for battery calendar aging simulation, with the battery table-based block, I enable the calendar aging function, I think which means my cell capacity now will decrease with the time
but I cannot find any port to output or somewhere to allow me to extract the battery capacity data. So I want to know, if I run a 100 weeks calendar aging simulation, and I want to obtain the capacity degradation curve (like the figure below, here I choose a cycle aging as an example, the axle x is the cycle life or time, the axle y is the remaining capacity)
how could I extract the battery capacity information from the Battery (table-based) block, if someone can help me, I will be very grateful, thanks.
(By the way, I have reviewed the help document regarding Battery (table-based) and Simscape battery, I also check the video "simscape battery essentials part 1 to 7" on Youtube, but cannot find the solution.) I am using simscape battery toolbox for battery calendar aging simulation, with the battery table-based block, I enable the calendar aging function, I think which means my cell capacity now will decrease with the time
but I cannot find any port to output or somewhere to allow me to extract the battery capacity data. So I want to know, if I run a 100 weeks calendar aging simulation, and I want to obtain the capacity degradation curve (like the figure below, here I choose a cycle aging as an example, the axle x is the cycle life or time, the axle y is the remaining capacity)
how could I extract the battery capacity information from the Battery (table-based) block, if someone can help me, I will be very grateful, thanks.
(By the way, I have reviewed the help document regarding Battery (table-based) and Simscape battery, I also check the video "simscape battery essentials part 1 to 7" on Youtube, but cannot find the solution.) calendar aging, simscape battery, battery table-based block MATLAB Answers — New Questions
In stereocalibration, is the relationship between the ‘R and T output as PoseCamera2’ and the actual camera position the same, or does the sign of x in T reverse?
I am currently calibrating four cameras (Camera1, Camera2, Camera3, Camera4). To do this, I have created pairs (Camera1 & Camera2, Camera2 & Camera3, Camera1 & Camera4) and performed calibration to determine the relative positions of all cameras in the coordinate system of Camera1. For Camera1 and Camera2, I added about 80 images of a checkerboard taken using the stereocalibration feature of the calibration app for calibration.
As a result, I obtained the following:
R = [0.794, -0.0318, 0.605; 0.0226, 0.999, 0.0228; -0.606, -0.00446, 0.795]
T = [-2793, 44.86, 483.2] (units in [mm]).
The visual output, which I have attached as an image, shows that rotating Camera2 by R and translating it by T to align with the coordinate system of Camera1 makes it coincide with Camera1. Therefore, it can be seen that R and T correspond with the visual output.
However, the actual relative position of Camera2 to Camera1 in the coordinate system of Camera1 should be [2793, 44.86, 482.3]. Thus, I am considering that the sign of the x component of T obtained through stereocalibration might be reversed compared to the actual T. Is my understanding incorrect?I am currently calibrating four cameras (Camera1, Camera2, Camera3, Camera4). To do this, I have created pairs (Camera1 & Camera2, Camera2 & Camera3, Camera1 & Camera4) and performed calibration to determine the relative positions of all cameras in the coordinate system of Camera1. For Camera1 and Camera2, I added about 80 images of a checkerboard taken using the stereocalibration feature of the calibration app for calibration.
As a result, I obtained the following:
R = [0.794, -0.0318, 0.605; 0.0226, 0.999, 0.0228; -0.606, -0.00446, 0.795]
T = [-2793, 44.86, 483.2] (units in [mm]).
The visual output, which I have attached as an image, shows that rotating Camera2 by R and translating it by T to align with the coordinate system of Camera1 makes it coincide with Camera1. Therefore, it can be seen that R and T correspond with the visual output.
However, the actual relative position of Camera2 to Camera1 in the coordinate system of Camera1 should be [2793, 44.86, 482.3]. Thus, I am considering that the sign of the x component of T obtained through stereocalibration might be reversed compared to the actual T. Is my understanding incorrect? I am currently calibrating four cameras (Camera1, Camera2, Camera3, Camera4). To do this, I have created pairs (Camera1 & Camera2, Camera2 & Camera3, Camera1 & Camera4) and performed calibration to determine the relative positions of all cameras in the coordinate system of Camera1. For Camera1 and Camera2, I added about 80 images of a checkerboard taken using the stereocalibration feature of the calibration app for calibration.
As a result, I obtained the following:
R = [0.794, -0.0318, 0.605; 0.0226, 0.999, 0.0228; -0.606, -0.00446, 0.795]
T = [-2793, 44.86, 483.2] (units in [mm]).
The visual output, which I have attached as an image, shows that rotating Camera2 by R and translating it by T to align with the coordinate system of Camera1 makes it coincide with Camera1. Therefore, it can be seen that R and T correspond with the visual output.
However, the actual relative position of Camera2 to Camera1 in the coordinate system of Camera1 should be [2793, 44.86, 482.3]. Thus, I am considering that the sign of the x component of T obtained through stereocalibration might be reversed compared to the actual T. Is my understanding incorrect? image processing, calibratrion, stereocalibration MATLAB Answers — New Questions
A problem in using imhist to display histogram of indexed image
First i convert the image to an indexed image, and use only 5 colors to show what is my problem.
clear
img = imread(‘peppers.png’);
[x,map] = rgb2ind(img,5);
figure;
imhist(x,map)
<</matlabcentral/answers/uploaded_files/44260/imhist.PNG>>
the colorbar doesn’t match with the histogarm bars, this is my colormap:
map =
0.2784 0.1373 0.2353
0.7608 0.1686 0.1373
0.8902 0.7255 0.6353
0.4275 0.3765 0.2235
0.8471 0.5569 0.1020
the first one isn’t white, It seems that the colorbar is shifted by one.First i convert the image to an indexed image, and use only 5 colors to show what is my problem.
clear
img = imread(‘peppers.png’);
[x,map] = rgb2ind(img,5);
figure;
imhist(x,map)
<</matlabcentral/answers/uploaded_files/44260/imhist.PNG>>
the colorbar doesn’t match with the histogarm bars, this is my colormap:
map =
0.2784 0.1373 0.2353
0.7608 0.1686 0.1373
0.8902 0.7255 0.6353
0.4275 0.3765 0.2235
0.8471 0.5569 0.1020
the first one isn’t white, It seems that the colorbar is shifted by one. First i convert the image to an indexed image, and use only 5 colors to show what is my problem.
clear
img = imread(‘peppers.png’);
[x,map] = rgb2ind(img,5);
figure;
imhist(x,map)
<</matlabcentral/answers/uploaded_files/44260/imhist.PNG>>
the colorbar doesn’t match with the histogarm bars, this is my colormap:
map =
0.2784 0.1373 0.2353
0.7608 0.1686 0.1373
0.8902 0.7255 0.6353
0.4275 0.3765 0.2235
0.8471 0.5569 0.1020
the first one isn’t white, It seems that the colorbar is shifted by one. imhist, colorbar, indexed image MATLAB Answers — New Questions
Reinforcement learning with action updated once every few (say 100) time steps
Hello,
I am trying to learn a controller in Simulink environment. I am tryng to use reinforcement learning where the action determined by the agent is updated once every few time steps, i.e., an action once determined by the agent is used for by Simulink to run the simulation for a few time steps before it is updated again. Please provide me with suggestions on this. Thank you.Hello,
I am trying to learn a controller in Simulink environment. I am tryng to use reinforcement learning where the action determined by the agent is updated once every few time steps, i.e., an action once determined by the agent is used for by Simulink to run the simulation for a few time steps before it is updated again. Please provide me with suggestions on this. Thank you. Hello,
I am trying to learn a controller in Simulink environment. I am tryng to use reinforcement learning where the action determined by the agent is updated once every few time steps, i.e., an action once determined by the agent is used for by Simulink to run the simulation for a few time steps before it is updated again. Please provide me with suggestions on this. Thank you. reinforcement learing, simulink MATLAB Answers — New Questions
What’s the best way to visualize position/zscore over multiple subjects?
I’ve been struggling to find a way to visualize the correlation between zscore (zscore.csv) and position (xcord.csv) from electrophysiological recordings. I only one dimension of position, but because the recordings were done over time I end up with 17940×2 per animal.
I tried to average z-scores into a new set of bins (new_bins.csv) that spams all the positions of all the animals, but don’t know if that would make a good visualization. Also tried to plot all the values as average of x values and average of z scores, but because there’s a clear preferance of side by the animal, I end up with too many datapoints on one end.
Is there a way to average the values of zscores respective to the values for x that fall into the new bins? Or is there a better way to visualize this altogether? The best example I found so far was panel D of this figure, but I don’t think it made it to their github.I’ve been struggling to find a way to visualize the correlation between zscore (zscore.csv) and position (xcord.csv) from electrophysiological recordings. I only one dimension of position, but because the recordings were done over time I end up with 17940×2 per animal.
I tried to average z-scores into a new set of bins (new_bins.csv) that spams all the positions of all the animals, but don’t know if that would make a good visualization. Also tried to plot all the values as average of x values and average of z scores, but because there’s a clear preferance of side by the animal, I end up with too many datapoints on one end.
Is there a way to average the values of zscores respective to the values for x that fall into the new bins? Or is there a better way to visualize this altogether? The best example I found so far was panel D of this figure, but I don’t think it made it to their github. I’ve been struggling to find a way to visualize the correlation between zscore (zscore.csv) and position (xcord.csv) from electrophysiological recordings. I only one dimension of position, but because the recordings were done over time I end up with 17940×2 per animal.
I tried to average z-scores into a new set of bins (new_bins.csv) that spams all the positions of all the animals, but don’t know if that would make a good visualization. Also tried to plot all the values as average of x values and average of z scores, but because there’s a clear preferance of side by the animal, I end up with too many datapoints on one end.
Is there a way to average the values of zscores respective to the values for x that fall into the new bins? Or is there a better way to visualize this altogether? The best example I found so far was panel D of this figure, but I don’t think it made it to their github. visualization, heatmaps, zscore MATLAB Answers — New Questions
Default data division in trainAutoencoder
Hello,
Can anyone explain why the default data division for the trainAutoencoder function (example usage here Train Stacked Autoencoders for Image Classification) uses the default data division method "dividetrain", i.e., data division is training only, rather than a training/validation/testing one (e.g., dividerand, divideint, etc.)?
Thanks.Hello,
Can anyone explain why the default data division for the trainAutoencoder function (example usage here Train Stacked Autoencoders for Image Classification) uses the default data division method "dividetrain", i.e., data division is training only, rather than a training/validation/testing one (e.g., dividerand, divideint, etc.)?
Thanks. Hello,
Can anyone explain why the default data division for the trainAutoencoder function (example usage here Train Stacked Autoencoders for Image Classification) uses the default data division method "dividetrain", i.e., data division is training only, rather than a training/validation/testing one (e.g., dividerand, divideint, etc.)?
Thanks. autoencoder, data division MATLAB Answers — New Questions
I want to perform this time derivative?
i want to perfrom this time derivative of volume which depends upon Ab and r_dot_L, these factor are calculated before and has an array of (600(time tb) x 412(distance X)) both of the values are time dependent and changes with respect to X.i want to perfrom this time derivative of volume which depends upon Ab and r_dot_L, these factor are calculated before and has an array of (600(time tb) x 412(distance X)) both of the values are time dependent and changes with respect to X. i want to perfrom this time derivative of volume which depends upon Ab and r_dot_L, these factor are calculated before and has an array of (600(time tb) x 412(distance X)) both of the values are time dependent and changes with respect to X. ode45 MATLAB Answers — New Questions
Using a newer version of plot (ezplot to fimplicit or fplot)
See https://uk.mathworks.com/matlabcentral/answers/327895-how-do-i-plot-a-circular-arc-with-given-two-endpoints-and-radius#answer_272169 for context
Using the answers from this question I was able to edit the code from the link above to get the general arc shape that I wanted.
However, I have a few issues, mainly down to my lack of experience:
1) ezplot isn’t recommended for the type of shape, so fplot and fimplicit are suggested as alternatives, and I’m not sure how to change ezplot over and maintain the same arc image
2) I need a functionality to change the thickness of the line which it doesn’t currently have
3) With this code it isn’t necessary but being able to plot multiple similar arcs on the same graph is also important
I’ve looked through the help centre for ezplot, fplot and fimplicit and I’m really not sure where I’m going wrong.
Code is pasted below
sparse.vein = [13 28.5 2 90 45 12.1935; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0];
sparse.cross_vein = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
sf1 = 4;
sf2 = -2;
sf3 = 20;
vein1_p1 = [sf1 * sparse.vein(1,1), sf2 * sparse.vein(1,2)]; %point 1
vein1_p2 = [sf1 * sparse.vein(1,4), sf2 * sparse.vein(1,5)]; %point 2
vein1_r = sf3 * [sparse.vein(1,6)]; %radius value
%vein1_t = line thickness
limA = [0 400];
limB = [-200 0]; % [0 400 -200 0]
%first input
a=vein1_p1; %P1
b=vein1_p2; %P2
r=vein1_r; %radius
%next solution
syms x y
[x,y]=solve((x-a(1))^2+(y-a(2))^2==r^2,(x-b(1))^2+(y-b(2))^2==r^2,x,y);
%plot arc
syms X Y
ezplot((X-x(1))^2+(Y-y(1))^2==r^2,[min(52,360),max(52,360), …
min(-200,0),max(-200,0)])
axis ([0 400 -200 0])
figure
ezplot((X-x(2))^2+(Y-y(2))^2==r^2,[min(52,360),max(52,360), …
min(-200,0),max(-200,0)])
axis ([0 400 -200 0])See https://uk.mathworks.com/matlabcentral/answers/327895-how-do-i-plot-a-circular-arc-with-given-two-endpoints-and-radius#answer_272169 for context
Using the answers from this question I was able to edit the code from the link above to get the general arc shape that I wanted.
However, I have a few issues, mainly down to my lack of experience:
1) ezplot isn’t recommended for the type of shape, so fplot and fimplicit are suggested as alternatives, and I’m not sure how to change ezplot over and maintain the same arc image
2) I need a functionality to change the thickness of the line which it doesn’t currently have
3) With this code it isn’t necessary but being able to plot multiple similar arcs on the same graph is also important
I’ve looked through the help centre for ezplot, fplot and fimplicit and I’m really not sure where I’m going wrong.
Code is pasted below
sparse.vein = [13 28.5 2 90 45 12.1935; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0];
sparse.cross_vein = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
sf1 = 4;
sf2 = -2;
sf3 = 20;
vein1_p1 = [sf1 * sparse.vein(1,1), sf2 * sparse.vein(1,2)]; %point 1
vein1_p2 = [sf1 * sparse.vein(1,4), sf2 * sparse.vein(1,5)]; %point 2
vein1_r = sf3 * [sparse.vein(1,6)]; %radius value
%vein1_t = line thickness
limA = [0 400];
limB = [-200 0]; % [0 400 -200 0]
%first input
a=vein1_p1; %P1
b=vein1_p2; %P2
r=vein1_r; %radius
%next solution
syms x y
[x,y]=solve((x-a(1))^2+(y-a(2))^2==r^2,(x-b(1))^2+(y-b(2))^2==r^2,x,y);
%plot arc
syms X Y
ezplot((X-x(1))^2+(Y-y(1))^2==r^2,[min(52,360),max(52,360), …
min(-200,0),max(-200,0)])
axis ([0 400 -200 0])
figure
ezplot((X-x(2))^2+(Y-y(2))^2==r^2,[min(52,360),max(52,360), …
min(-200,0),max(-200,0)])
axis ([0 400 -200 0]) See https://uk.mathworks.com/matlabcentral/answers/327895-how-do-i-plot-a-circular-arc-with-given-two-endpoints-and-radius#answer_272169 for context
Using the answers from this question I was able to edit the code from the link above to get the general arc shape that I wanted.
However, I have a few issues, mainly down to my lack of experience:
1) ezplot isn’t recommended for the type of shape, so fplot and fimplicit are suggested as alternatives, and I’m not sure how to change ezplot over and maintain the same arc image
2) I need a functionality to change the thickness of the line which it doesn’t currently have
3) With this code it isn’t necessary but being able to plot multiple similar arcs on the same graph is also important
I’ve looked through the help centre for ezplot, fplot and fimplicit and I’m really not sure where I’m going wrong.
Code is pasted below
sparse.vein = [13 28.5 2 90 45 12.1935; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0];
sparse.cross_vein = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
sf1 = 4;
sf2 = -2;
sf3 = 20;
vein1_p1 = [sf1 * sparse.vein(1,1), sf2 * sparse.vein(1,2)]; %point 1
vein1_p2 = [sf1 * sparse.vein(1,4), sf2 * sparse.vein(1,5)]; %point 2
vein1_r = sf3 * [sparse.vein(1,6)]; %radius value
%vein1_t = line thickness
limA = [0 400];
limB = [-200 0]; % [0 400 -200 0]
%first input
a=vein1_p1; %P1
b=vein1_p2; %P2
r=vein1_r; %radius
%next solution
syms x y
[x,y]=solve((x-a(1))^2+(y-a(2))^2==r^2,(x-b(1))^2+(y-b(2))^2==r^2,x,y);
%plot arc
syms X Y
ezplot((X-x(1))^2+(Y-y(1))^2==r^2,[min(52,360),max(52,360), …
min(-200,0),max(-200,0)])
axis ([0 400 -200 0])
figure
ezplot((X-x(2))^2+(Y-y(2))^2==r^2,[min(52,360),max(52,360), …
min(-200,0),max(-200,0)])
axis ([0 400 -200 0]) plot, 2d, arc, radius, between two points MATLAB Answers — New Questions
Image hidding using DWT
Hello every one
I am finding a problime in my code for hidding 325*325 image into 2300*2300 image after decompose it using into HH{3} to get the best PSNR and MSE
and the erroe say that the matrix in not matching.
the code is as follow:-
% Main code
clc
close all;
clear all;
%
a=imgetfile();
coverImage1 = imread(a);
coverImages = imresize(coverImage1,[2600 2600]);
R=coverImages(:,:,1); %red = 1, green = 2, blue = 3
G=coverImages(:,:,2);
B=coverImages(:,:,3);
coverImage=B;
% figure;
% imshow(coverImage);
% title(‘Blue Image’);
%%%%%
b=imgetfile();
secretImage1 = imread(b);
%secretImage=B1;
secretImage= rgb2gray(secretImage1);
secretImage = imresize(secretImage,[1300 1300]);
row = size(secretImage,1);
col = size(secretImage,2);
s = row*col;
%secretImage = imresize(secretImage,[280 280]);
% figure(1); imshow (coverImages)
% figure(2); imshow (secretImage)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Perform DNA encryption on the secret image
key = randi([0, 255], size(secretImage)); % Generate random key
encryptedImage = DNAEncrypt(secretImage, key);
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nColors = 256;
n =3 ; %# Number of decompositions
LL = cell(1,n); %# Approximation coefficient storage
LH = cell(1,n); %# Horizontal detail coefficient storage
HL = cell(1,n); %# Vertical detail coefficient storage
HH = cell(1,n); %# Diagonal detail coefficient storage
X = coverImage ;
for i = 1:n %# %# Apply nLevel decompositions
[LL{i},LH{i},HL{i},HH{i}] = dwt2(X,’Haar’);
X = LL{i}; % gives you the last quarter of the image
end
%coverImage = LL{i}; % gives you the last quarter of the image
%alpha = 0.02; % Embedding strength
OO= HH{1}; OOO = HH{2}; OOOO=HH{3};% here I want to get the need HH{1,2,3} for the good hidding
%%
HH_embedded = HH{1} + ( encryptedImage);
stegoImage = idwt2(LL{i}, LH{i}, HL{i}, HH_embedded, ‘haar’);
imshow(uint8(stegoImage));
% %%
% tiledImage = wcodemat(LL{n},nColors);
% for i = n:-1:1
% tiledImage = cat(1,cat(2,tiledImage,…
% wcodemat(LH{i},nColors)),…
% cat(2,wcodemat(HL{i},nColors),…
% wcodemat(HH{i},nColors)));
% end
% figure(1);imshow(uint8(tiledImage-1));
%%
B2=uint8(stegoImage);
RGB= cat(3, R, G, B2);
stg= double(im2gray(RGB));
% figure (5)
% subplot(1, 2, 1);
% imshow(RGB);
% title(‘RGB after Analysis’);
%%%%
% Display the stego image
figure;
subplot(1, 2, 1);
imshow(coverImages);
title(‘Cover Image’);
subplot(1, 2, 2);
imshow(RGB);
title(‘Stego Image’);
%%%%%%%%%%%%%
%TT = immse(stg, double(coverImage));
mse = sum(sum((coverImage – uint8(stg)) .^ 2)) / numel(coverImage);
% Display the MSE
fprintf(‘Mean Squared Error (MSE): %.4fn’, mse);
%CC = mse(stgcoverImage);
C = psnr((uint8(stg)),coverImage);
%fprintf(‘n The Mean Sq. Erorr value is %0.4f’, CC );
fprintf(‘n PSNR value is %0.6f’, C);
%%
%
I will write the code here and provide you the images, hope to get it downHello every one
I am finding a problime in my code for hidding 325*325 image into 2300*2300 image after decompose it using into HH{3} to get the best PSNR and MSE
and the erroe say that the matrix in not matching.
the code is as follow:-
% Main code
clc
close all;
clear all;
%
a=imgetfile();
coverImage1 = imread(a);
coverImages = imresize(coverImage1,[2600 2600]);
R=coverImages(:,:,1); %red = 1, green = 2, blue = 3
G=coverImages(:,:,2);
B=coverImages(:,:,3);
coverImage=B;
% figure;
% imshow(coverImage);
% title(‘Blue Image’);
%%%%%
b=imgetfile();
secretImage1 = imread(b);
%secretImage=B1;
secretImage= rgb2gray(secretImage1);
secretImage = imresize(secretImage,[1300 1300]);
row = size(secretImage,1);
col = size(secretImage,2);
s = row*col;
%secretImage = imresize(secretImage,[280 280]);
% figure(1); imshow (coverImages)
% figure(2); imshow (secretImage)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Perform DNA encryption on the secret image
key = randi([0, 255], size(secretImage)); % Generate random key
encryptedImage = DNAEncrypt(secretImage, key);
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nColors = 256;
n =3 ; %# Number of decompositions
LL = cell(1,n); %# Approximation coefficient storage
LH = cell(1,n); %# Horizontal detail coefficient storage
HL = cell(1,n); %# Vertical detail coefficient storage
HH = cell(1,n); %# Diagonal detail coefficient storage
X = coverImage ;
for i = 1:n %# %# Apply nLevel decompositions
[LL{i},LH{i},HL{i},HH{i}] = dwt2(X,’Haar’);
X = LL{i}; % gives you the last quarter of the image
end
%coverImage = LL{i}; % gives you the last quarter of the image
%alpha = 0.02; % Embedding strength
OO= HH{1}; OOO = HH{2}; OOOO=HH{3};% here I want to get the need HH{1,2,3} for the good hidding
%%
HH_embedded = HH{1} + ( encryptedImage);
stegoImage = idwt2(LL{i}, LH{i}, HL{i}, HH_embedded, ‘haar’);
imshow(uint8(stegoImage));
% %%
% tiledImage = wcodemat(LL{n},nColors);
% for i = n:-1:1
% tiledImage = cat(1,cat(2,tiledImage,…
% wcodemat(LH{i},nColors)),…
% cat(2,wcodemat(HL{i},nColors),…
% wcodemat(HH{i},nColors)));
% end
% figure(1);imshow(uint8(tiledImage-1));
%%
B2=uint8(stegoImage);
RGB= cat(3, R, G, B2);
stg= double(im2gray(RGB));
% figure (5)
% subplot(1, 2, 1);
% imshow(RGB);
% title(‘RGB after Analysis’);
%%%%
% Display the stego image
figure;
subplot(1, 2, 1);
imshow(coverImages);
title(‘Cover Image’);
subplot(1, 2, 2);
imshow(RGB);
title(‘Stego Image’);
%%%%%%%%%%%%%
%TT = immse(stg, double(coverImage));
mse = sum(sum((coverImage – uint8(stg)) .^ 2)) / numel(coverImage);
% Display the MSE
fprintf(‘Mean Squared Error (MSE): %.4fn’, mse);
%CC = mse(stgcoverImage);
C = psnr((uint8(stg)),coverImage);
%fprintf(‘n The Mean Sq. Erorr value is %0.4f’, CC );
fprintf(‘n PSNR value is %0.6f’, C);
%%
%
I will write the code here and provide you the images, hope to get it down Hello every one
I am finding a problime in my code for hidding 325*325 image into 2300*2300 image after decompose it using into HH{3} to get the best PSNR and MSE
and the erroe say that the matrix in not matching.
the code is as follow:-
% Main code
clc
close all;
clear all;
%
a=imgetfile();
coverImage1 = imread(a);
coverImages = imresize(coverImage1,[2600 2600]);
R=coverImages(:,:,1); %red = 1, green = 2, blue = 3
G=coverImages(:,:,2);
B=coverImages(:,:,3);
coverImage=B;
% figure;
% imshow(coverImage);
% title(‘Blue Image’);
%%%%%
b=imgetfile();
secretImage1 = imread(b);
%secretImage=B1;
secretImage= rgb2gray(secretImage1);
secretImage = imresize(secretImage,[1300 1300]);
row = size(secretImage,1);
col = size(secretImage,2);
s = row*col;
%secretImage = imresize(secretImage,[280 280]);
% figure(1); imshow (coverImages)
% figure(2); imshow (secretImage)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Perform DNA encryption on the secret image
key = randi([0, 255], size(secretImage)); % Generate random key
encryptedImage = DNAEncrypt(secretImage, key);
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nColors = 256;
n =3 ; %# Number of decompositions
LL = cell(1,n); %# Approximation coefficient storage
LH = cell(1,n); %# Horizontal detail coefficient storage
HL = cell(1,n); %# Vertical detail coefficient storage
HH = cell(1,n); %# Diagonal detail coefficient storage
X = coverImage ;
for i = 1:n %# %# Apply nLevel decompositions
[LL{i},LH{i},HL{i},HH{i}] = dwt2(X,’Haar’);
X = LL{i}; % gives you the last quarter of the image
end
%coverImage = LL{i}; % gives you the last quarter of the image
%alpha = 0.02; % Embedding strength
OO= HH{1}; OOO = HH{2}; OOOO=HH{3};% here I want to get the need HH{1,2,3} for the good hidding
%%
HH_embedded = HH{1} + ( encryptedImage);
stegoImage = idwt2(LL{i}, LH{i}, HL{i}, HH_embedded, ‘haar’);
imshow(uint8(stegoImage));
% %%
% tiledImage = wcodemat(LL{n},nColors);
% for i = n:-1:1
% tiledImage = cat(1,cat(2,tiledImage,…
% wcodemat(LH{i},nColors)),…
% cat(2,wcodemat(HL{i},nColors),…
% wcodemat(HH{i},nColors)));
% end
% figure(1);imshow(uint8(tiledImage-1));
%%
B2=uint8(stegoImage);
RGB= cat(3, R, G, B2);
stg= double(im2gray(RGB));
% figure (5)
% subplot(1, 2, 1);
% imshow(RGB);
% title(‘RGB after Analysis’);
%%%%
% Display the stego image
figure;
subplot(1, 2, 1);
imshow(coverImages);
title(‘Cover Image’);
subplot(1, 2, 2);
imshow(RGB);
title(‘Stego Image’);
%%%%%%%%%%%%%
%TT = immse(stg, double(coverImage));
mse = sum(sum((coverImage – uint8(stg)) .^ 2)) / numel(coverImage);
% Display the MSE
fprintf(‘Mean Squared Error (MSE): %.4fn’, mse);
%CC = mse(stgcoverImage);
C = psnr((uint8(stg)),coverImage);
%fprintf(‘n The Mean Sq. Erorr value is %0.4f’, CC );
fprintf(‘n PSNR value is %0.6f’, C);
%%
%
I will write the code here and provide you the images, hope to get it down dwt, image processing MATLAB Answers — New Questions