Is my code wrong because why am i getting this output? Use the MATLAB command conv2() to convolve image3 with itself. What is this process referred to as? Show the result.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Can someone explain why i got this output from this code?Is the code wrong?
img3=imread("image3 (1).png")
C = conv2(img3,img3)
imshow(C,[])
plot(C)
0 comentarios
Respuestas (1)
Walter Roberson
el 7 de Dic. de 2022
The image you posted is an RGB image, not a grayscale image. You cannot use conv2() with it, not unless you select out a single channel.
If you do select out a single channel then the plot() looks different than what you posted.
Your C is a 511 x 511 array. When you plot() it, you are asking for one line to be drawn for each column of C -- 511 lines in total. You should expect it to be difficult to make sense of such a line plot.
3 comentarios
Walter Roberson
el 7 de Dic. de 2022
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1223422/image.png';
img3 = imread(filename);
size(img3)
C = conv2(img3,img3);
size(C)
imshow(C, [])
Walter Roberson
el 7 de Dic. de 2022
The 480 x 522 x 3 size tells us that the image you posted is an RGB image, not a grayscale image. conv2() has never been supported for RGB images.
If you convert the posted image to grayscale and do the conv2() with itself on that, then C comes out as 959 by 1043 not the 511 x 511 that is shown in your output.
We have to conclude that the image you posted is not image3 (1).png . Perhaps what you posted is the output of the imshow() (but that is doubtful, imshow() would not have produced a 480 x 522 output for a 511 x 511 image.)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!