How to extract the original image from a set of modified images? - image-processing

Given a set of N images, where each image can be described as
image = baseImage + uniqueOverlay
and the "uniqueOverlay" was added onto the "baseImage" using an unknown alpha value, which is constant for all images, how can I extract the unknown "baseImage"?
I have a feeling an algorithm for this already exists, but I am not able to find it as I am not very experience in image processing.

Related

Have the inverse operation of ‘stereoRectify’ in OPENCV?

Firstly, 'stereorectify' have already done based on binocular vision, and then the image matching calculation is made with the corrected image. The matching points of the left and right images have been generated. Now it is necessary to restore the coordinates of the matching points to the coordinates before the image rectify. How can I do?
enter image description here
I have find "initInverseRectificationMap()"in OPENCV 4.5.3,enter link description here
And I make a test to compare the image after 'stereorectify' with the image after 'InverseRectification' enter image description here,the two images are not on the same horizontal line
In addition, I compare the image without 'stereorectify' with the image after 'InverseRectification'enter image description here,the two images are parallel on a horizontal line
so,"initInverseRectificationMap()" worked.
but it works on the image type,how it works on "Point2f"?

Opencv increases image's size after rotation

I am using opencv in python to rotate an image and the original and the resulted images are differrent is somethings, I am doing my transformation through this part of code:
img = cv2.imread("image.tif")
new_image = cv2.getRotationMatrix2D((cols / 2, rows / 2), correction_angle, 1)
dst = cv2.warpAffine(img, new_image , (cols, rows))
cv2.imwrite("Rotated_image.tif", dst)
The original image's size is 1.7 Mb, The image's resolution is 300
dpi, and the color space is YCbCr.
The issue is that the resulting image with 12.5 Mb size, 96 dpi, the color space is RGB, and with compression "LZW"!
My question is that: Can I keep the main properties of the original image? and why rotating an image changes the size this way?
Note: The bit depth is 24 in both images.
Calling cv2.imread with only the name of the file uses the default value cv.IMREAD_COLOR for the second parameter, about which the documentation says:
If set, always convert image to the 3 channel BGR color image.
So, your image is always converted to RGB. You can try using cv.IMREAD_ANYCOLOR for the second parameter of imread, but I don't think you can use cv2.warpAffine on it trivially then.
The difference in the stored DPI information stems from the fact that you write the new image without any meta data. imwrite allows you to specify parameters (see here), but, unfortunately, they are not very well documented. I am not sure if this kind of data can be written out of the box with OpenCV.

Deepzoom images: starting image quality

I am working on implementing a zoomable image viewer using OpenSeadragon and deep zoom images. I used the VIPS command line tool to create DZI files. My question is, does the original image used to create DZI files need to meet specific requirements to make it zoomable? (like format, size, etc.) If a normal .jpg image is converted to DZI, it seems like the image will not be zoomable. Is this correct?
My question is, does the original image used to create DZI files need to meet specific requirements to make it zoomable?
No, except to have a resolution higher than the screen resolution (in that case, the original image can be displayed directly).

xamarin iOS alasset fullresolution image with filter

I am working on a Xamarin IOS application, testing on a iPhone5 version 8.1.3, where I let the user select images with the ALAssetLibrary. These images get send to a server and get processed. There is a minimum size to these images so I need the complete image.
I have a bit of a problem with getting the full resolution images.
First I check the size of the images with asset.DefaultRepresentation.Dimensions. After that I get the image with asset.DefaultRepresentation.GetImage(). Now here i have three different cases.
a image with no filter
a image made with a filter
a image made without a filter, and a filter later applied to it
In all three cases the dimensions give me a value like h:3500 w: 2800. Which is exactly what I need. When i get the images in the first and third case it gives me a image with the same size. But in the second case it gives me a image with something like h:910 w: 640; Which is the same size as asset.DefaultRepresentation.GetFullScreenImage() would give me.
Is there any way to get a full size image when the image is made with a filter?
EDIT
Also when I make a photo with a filter and then remove the filter from the image I get a image with h:3500 w:2800. This means that the original image must be present. I just need to know how to get it.

Is it possible for Paperclip to generate a new image (with no source)?

I'm building an image based off of user input -- the background will either be an image or a color, and then a few other images may or may not be composed on top.
Checking through the paperclip docs, it mentions that you can use ImageMagik to post-process images, and that post-processing will never fire if it doesnt already have an image.
If I am able to make the imagemagik scripts to compose/color/resize an image, is there a way for it to generate the image, or will I need to include some sort of hackish pixel to upload (and then postprocess in to the image I want)?
ImageMagick can generate a starting image for you, consisting of a simple rectangle filled with a single color. For example, this will generate a 150x100 red image:
convert -size 150x100 xc:"#ff0000" starting_image.png
I would try the following:
Have a default image in my app's assets folder
If the model to be saved has no attachment then I would assign it the one mentioned above: a_model.image = File.open('...')
Then, upon save of the a_model the post-processing should take place normally

Resources