1

When using this command:

Mat im_gray = imread("C:\\Users\\USER\\Documents\\Blue.jpg", CV_LOAD_IMAGE_GRAYSCALE);

the image is not only loaded but its shape is changed.

This is the original image: original image

This is the resultant image when loading it :

loaded image

How can the image be loaded, while maintaining the same shape ?

Katia Abela
  • 271
  • 7
  • 17

1 Answers1

1

Did you see this question? Basically, the image was changing shape because it was too big for the screen. What happens if you rotate the image before you imread() it? Better yet, make it scalable like the answer I linked above and you should be good.

Community
  • 1
  • 1
kmort
  • 2,848
  • 2
  • 32
  • 54
  • I've seen the link. The only thing I don't understand is img.shape[1] and img.shape[0] in the scale_width and scale_height variables. What are these calculating. Also, what could be changed for a C++ equivalent? – Katia Abela Mar 08 '14 at 02:34
  • @user3050012 `img.shape[1]` is the width of your source image. `img.shape[0]` is the height of your source image. – kmort Mar 08 '14 at 03:32