I'm using Django ImageField for user to upload image. I want to read the image directly from InMemoryUploadedFile byte to ndarray for processing. However, some of the images that appeared upright in my folder will be rotated. My images are all mobile phone camera photos. I suspect it is because of the exif info that cause the rotation.
I checked the exif info and it shows <Orientation.LEFT_BOTTOM: 8>. This is same as what I get as the image is rotated 270 degree counter-clockwise. Is there anyway I can read the image from byte to ndarray in upright orientation as per what I see in file explorer?
Below is how I read the image in view.py
upload_file_1 = request.FILES.get('image1', None)
image_1 = cv2.imdecode(np.frombuffer(upload_file_1.file.read(), np.uint8), cv2.IMREAD_UNCHANGED)
p/s: I don't want to save the raw upload image to media folder before postprocessing.
Related
I'm trying to add images to a video using mediaconvert. I used mediaconvert graphic overlay/ image inserter to perform this task. However, the image is overriding the given video in the output for the given duration. I want the image to be still at first and then start the video from the beginning if I add an image and similarly for the rest of the images. Can this be done by using aws-mediaconvert?
Overlays are normally used for things like watermarks and logos or simple sports scores/news tickers etc. Images you want to appear over the top of the video.
You could create a clip of blank video to insert into your output, then apply the overlay to just that?
Another option is to convert the image to a video yourself with ffmpeg and insert that into your output?
I use libvlc with vlc-qt to load, modify and show various streams and videos. It works well with all videos and streams which have top-left orientation. I have a video created with a smartglass, and it has top-right orientation.
When i opened this video with the vlc media player, it showed correctly, but when i loaded it to my program, it was upside down (because of the orientation).
How can i set it in vlc-qt/libvlc to automatically adjust the frames to the orientation? Based on the vlc media player, it must be possible somehow.
If it is not possible, i would be content with knowing how to get the video orientation from libvlc.
i would be content with knowing how to get the video orientation from libvlc.
libvlc_video_get_track returns a struct containing a field with orientation info.
Don't think you can rotate the video from libvlc API, you will need to provide CLI arguments to VLC through your wrapper/libvlc.
See https://wiki.videolan.org/VLC_command-line_help/
Video transformation filter (transform)
Rotate or flip the video
--transform-type={90,180,270,hflip,vflip,transpose,antitranspose}
I was trying to re save the image file if the orientation was not right. But the issue is when i try to rotate an image and overwrite it to the same file, it works fine but the EXIF informations are not being saved in the overwritten file.
But i want to save all the EXIF data in the new overwritten image as same as the old one except the orientation value. Please help. thanks.
I'm using this command to ftp upload a png image. But when I upload the image is not visible it looks like currupted even if I download it I can't view the image.
Here is the code
ftp.storlines('STOR ' + 'Simple.png', open('Simple.png', 'rb'))
here is the uploaded file
http://llgrow.co.nf/Simple.png
That's because ftp.storlines() is sending the file in ascii mode, you should use ftp.storbinary() for an image file (binary mode):
F=open("Simple.png","rb")
ftp.storbinary('STOR image.png',F,1024)
Try using storbinary()...
Because it takes the binary values of that image... So that no pixel values are messed up...
Since image files contain pixels... Need to store the exact X,Y positions of the pixels.
So storbinary() does that by default.
I am working on the gateway Simulator where Simulator will stream image/video to Data center
I have JPEG file for 30 min(lot of individual JPEG images).
Data Center Center can request video/Image with varying value of these parameter.
Image Option
1. Mirror Effect (None,Column,Row,Row / Column)
2. Brightness (Normal,Intense Light,Low Light,MAX)
3. Zoom Level (1X, 2X, 4X, 8X)
Capture mode
Single Snapshot- requests one image from the camera
Burst Number- NUMBER will gather N (1-65535) number of images from the camera
Burst Second-option produces a stream of images and will go until a CancelImageRequest command is sent
Continuous- option produces a stream of images and will go until a CancelImageRequest command is sent
Round-Robi-, is a mode to allow the user to get a single snapshot from each active and selected sensor
Schedule Continuous- THis is similar to Continuous except timing.
Now I need to read JPEG files based above mentioned option and send it to data center.
I wanted to how I can enforce these Image option while reading the data.
is there any Api which will allow reading JPeg imges on following Image option.
If you have any suggestion please go ahead.
GDI+ has an Image class that can load JPEGs and manipulate them -
http://msdn.microsoft.com/en-us/library/ms534462%28VS.85%29.aspx
If you don't find then manipulation you're looking for you can use the Bitmap class that ingerits from Image and the BitmapData class that allows you direct access to pixels
http://msdn.microsoft.com/en-us/library/ms534420%28VS.85%29.aspx