I have tried to reconstruct a image using Motion Compensation technique. When i try to compare the image with SSIM i get an error like this.

1 view (last 30 days)
??? Error using ==> ne Matrix dimensions must agree.
Error in ==> ssim at 84 if (size(img1) ~= size(img2))
Error in ==> MCpredict_Full at 92 [mssim, ssim_map] = ssim(img1, img2);

Accepted Answer

Image Analyst
Image Analyst on 14 Jun 2014
Probably one image is color (3D) and the other is monochrome (2D). Simply type out the size array before you compare. It's best to do something like this:
[rows1, columns1, numberOfColorChannels1] = size(img1)
[rows2, columns2, numberOfColorChannels2] = size(img2)
if rows1~=rows2 || columns1~=columns2
% Warn user that sizes don't match......
You might have to also check on the number of color channels, depending on what operations you want to do.
  2 Comments
Image Analyst
Image Analyst on 16 Jun 2014
jeffin's "Answer" moved here because it's a reply to me, not an answer to the originally posted question:
Sir, as you said you are correct. But when i check the resolution, the resolution of both the image is same. Thanks a lot for it. But when i run the ssim code i came across another error
??? Undefined function or method 'conv2' for input arguments of type 'double' and attributes 'full 3d real'.
Error in ==> filter2 at 73 y = conv2(hcol, hrow, x, shape);
Error in ==> ssim at 194 mu1 = filter2(window, img1, 'valid');
I goggled and found the solution that the image is in 3D, and it should be converted into grey scale.This works for normal images. But in my program, when i first convert the image into grey scale and get the reconstructed image using motion compensation, its fully a white blank image. And if i dont convert into greyscale and do motion compensation,i get an better reconstructed image, but the problem is in finding SSIM which i have mentioned above.
??? Undefined function or method 'conv2' for input ...
Kindly help me.
My next doubt is that i am actually trying to implement the frame rate up conversion conversion concept once i complete the motion compensation, in matlab. Is it possible to implement this frame rate up conversion conversion code in matlab? Or is there any code available for frame rate up conversion conversion in matlab tutorials.
Sir, my doubt is because i am a beginner in this area. Kindly reply me.
Image Analyst
Image Analyst on 16 Jun 2014
Edited: Image Analyst on 16 Jun 2014
You need to use conv2() on a 2D image - that's what the 2 means. If you want to convolve in 3D, which I highly doubt, you'd need to use convn(). To convolve a color image, you need to extract individual color channels, cast them to double, and then call conv2().
To display floating point images, you need to use [] in imshow:
imshow(y, []);

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!