I am trying to load an image with cv2.imread().
It works fine when width>height. However, when height>width, the output is sometimes rotated.
Is there a way to avoid this rotation?
Thank you
Related
im using OpenCV 4.3 with c++ and the VideoCapture to get the videostream from a Logitech C922 Pro Webcam.
Im changing the resolution with
cap.set(CAP_PROP_FRAME_HEIGHT,height)
cap.set(CAP_PROP_FRAME_WIDTH,width)
This works fine until im using either the resolution of 640x480 or 640x360. In this cases OpenCV stays in the aspect ratio it was before (640x480 on startup).
Is there an efficitent way to change the resolution to the right one instead of changing it to another one before?
CAP_PROP_FRAME_HEIGHT or CAP_PROP_FRAME_WIDTH are used to switch the resolution of your camera. If your camera doesn't support that resolution you set, the code will not work. If you check the specs of Logitech C922, you will see that it doesn't include the resolutions you desired.
There are other options you can apply:
1- You can crop the desired sizes(ex. 640,360) from the main frame.
2- You can resize the frame but this will crash the aspect ratio.
I'm making an app using Swift in Xcode. I have a few buttons and images on one of my View Controllers. I am using high resolution images, but I noticed that they pixelate to the point where it is visible to the naked eye. There are some questions that I have found pertaining to the resizing of images, but none regarding immediate pixelization. I was hoping someone could help. Below are two images. The first is an image (a screenshot) from my app and the second is an image (also a screenshot) from another app that is not mine. The icon on the other app is smaller, but despite this is less pixelated.
have you tried using svg instead of jpg (lossy) or png(lossless)? It would seem that this would be the way to go, since you can expand to perfect definition on all resizing screens. svg uses code instead of an image format that can be lossy and given the examples you have posted would solve your issue.
you can use paint code for more easy worked , with paint code you can export svg
I figured it out. I just had to increase the dpi
I am using a library called SnapSliderFilters to apply filters to an image. I need the filters to be applied exactly the way it is presented in the library's example.
When I implemented the code exactly as directed on an image captured with a custom camera, sliding sideways, while applying the image filter, it also causes the image to rotate by 90 degrees and the image to zoom.
In other case, when I select an image from gallery, that is of exact dimension as the screen, it works perfectly fine.
So, I think I have found the cause to be image size but I don't know where to begin.
Here is how it displays:
I'm trying to capture image using avfoundation framework without Flash and with Flash but i could not capture original image instead gives me black colour image while capturing it without Flash.
With the same code i can capture an image with lighting mode with Auto Flash, In that case i can able to see only part of image which has full light but not actual image.
I've set flashmode to AVCaptureFlashModeAuto.
Even with AVCaptureFlashModeOn captured image shows darker as compared to the original preview.
Help me to get it solved as i'm not able to find any solution.
Thanks.
I use ImageResizer in my web application. It resizes most of the images on the page correctly. But there is one set of images, that it rotates. The code is the same for all the images.
See the following link, if you remove the querystring for ?width=500, then the image is right, but the width, resizes the image and rotates it for some reason
Please any help would be appreciated.
Cameras do not rotate images according to the orientation sensor; they just set a flag in the metadata.
Install the AutoRotate plugin and put &autorotate=true in the querystring. This will cause the image to be rotated according to the metadata prior to any rotate commands.
When I downloaded the images they were upside down, I fixed this paint.net, re-uploaded, now they are fine. The funny thing is when viewing the image in browser without the querystring they were fine.Wierd...