how can i change the matrix dimension of an image?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
when i am using edge detection for cameraman.tif(256*256)image the input will be of 256*256 uint8 the output is 256*256 uint8 but when lena.tif(256*256) the input size becomes 256*256*3 uint8 the output will be 256*768 uint8. for this reason i can evaluate psnr value for cameraman,but for lena image, the error is matrix dimension not match in between original image and edge detected image.can any one suggest for any code for solve this error?
0 Commenti
Risposte (3)
Walter Roberson
il 30 Mag 2016
Edge detection algorithms typically work on grayscale images. Some of them do work on color images, but the one you are working with is likely working on grayscale, so you will need to use rgb2gray() on the lena image before doing the edge detection.
Image Analyst
il 30 Mag 2016
I don't know what your edge detection algorithm is doing but you might be using size() wrong. See Steve's blog: http://blogs.mathworks.com/steve/2011/03/22/too-much-information-about-the-size-function/
Also, lena is a color image and perhaps you need to convert it to grayscale with rgb2gray() or be extracting the green channel, which is usually the least noisy of the channels. Otherwise you'll have to decide how you want to compute and handle the psnr of a color image. By the way, the psnr() function in the Image Processing Toolbox can handle color images so is that what you used? (I doubt it.)
0 Commenti
John BG
il 30 Mag 2016
if you check size on the tiff file
A=imread('lena.tif')
[sz1 sz2 sz3]=size(A)
you will see the right size.
If you try
[sz1 sz2]=size(A)
MATLAB piles up everything that is not dimension 1 into the second size, giving a misleading size, that perhaps is what happens in your question
John
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!