Ask Your Question

sonal08's profile - activity

2019-04-25 05:04:42 -0600 received badge  Notable Question (source)
2017-11-12 20:08:54 -0600 received badge  Popular Question (source)
2015-04-24 19:44:55 -0600 commented answer image height and width swapping

thanks for the suggestion. I will try these tools in future. For now, I had written a code (which uses numpy->swapaxes function to swap between rows and columns).

2015-04-22 17:01:32 -0600 commented answer image height and width swapping

ohk yeah.. i get your point and that is why I wish to rotate the image manually before it can be read by opencv.. so is there a way I can rotate it using windows functionality which actually changes its original orientation and get recognized by open cv (besides using the code mentioned above though, I did not try the code yet)?

2015-04-22 06:33:37 -0600 commented answer image height and width swapping

But I don't know which of the ones need to be rotated. So, I am making an application which reads images from a folder and some of them are oriented properly while some have been rotated (using windows right-click->rotate right/left command) to orient it. So, in opencv I just read all the images in the folder. Is there a way where I can find incorrect orientation using opencv? But, I think it would be too much of a task since then, I would need to analyse image and find if the characters in the image have proper orientation or not.

2015-04-21 23:14:04 -0600 commented question image height and width swapping

please see the edit.

2015-04-21 23:13:40 -0600 commented answer image height and width swapping

I have edited my post to provide code and example scenario. I think when an image has been rotated using 'Windows->right-click->rotate right/left' command, it is only done for viewing purpose and it does not change the shape inside the image file. But, I want my opencv function to read rotated image. How can I do that?

2015-04-21 23:05:12 -0600 received badge  Editor (source)
2015-04-20 23:30:52 -0600 asked a question image height and width swapping

As I read my image using opencv imread function, I see that its height and width are being swapped. As a result, I see rotated image. This does not change even if I rotate image prior to it being read. What can be the workaround for this problem?

So, below I have provided the input images: one is original and second one is rotated (I rotated it using windows rotate command, by right-clicking and selecting 'rotate right'). Output I get for both the images is same. It seems to me that rotating image did not actually change its shape. I think so because, when I try to put the rotated image here then also, it was showing the un-rotated version of it only (in the preview) so, I had to take a screen-capture of it and then, paste it here.

This is the code: 'import cv2 import numpy as np import sys import os

image = cv2.imread("C:/img_8075.jpg") print "image shape: ",image.shape cv2.imshow("image",image) cv2.waitKey(0) image2 = cv2.imread("C:/img_8075_Rotated.jpg") print "image shape: ",image2.shape cv2.imshow("image",image2) cv2.waitKey(0)'

first_image rotated image

first image result second image result

output

I think the question should make sense now. Let me know if still further information is needed. Thanks for your help!