Transforming images using a function - image

How does one transform an image such that each pixel of the image is moved radially in/outwards by a certain amount that is determined by a user defined function? (In Wolfram Mathematica)

Related

Parallel overlaying of multiple images in govips

In Govips, is there a functionality to overlay multiple images on a base image parallelly?
There is a function - compositeMulti which takes a list of images but does it render it parallelly? Also, does it have a capability to identify which pixel of which image has to be rendered on the image , instead of iteratively going through all the images and rendering one by one.
libvips (the image processing library behind govips) is demand-driven and horizontally-threaded. The image processing pipeline being computed is represented as a graph, each thread on your PC picks a tile in the output image (usually 128 x 128 pixels), and threads independently walk the graph from end to start computing pixels.
The composite operator (the thing that compositeMulti calls) computes the result of overlaying a set of layers with PDF-style blend modes. For each tile, it selects the subset of layers which are visible at that point. It can only do this if the selected blending modes are 'skippable', ie. compositing black (the empty pixel) over the base image will have no effect.
You can see the test for skippability here:
https://github.com/libvips/libvips/blob/master/libvips/conversion/composite.cpp#L1273-L1296
And the layer culling loop is here:
https://github.com/libvips/libvips/blob/master/libvips/conversion/composite.cpp#L443-L460
Finally, the selected layers are composited, using vector arithmetic if possible. It represents an RGBA pixel as a vector of four floats and computes all of them together.
tldr: libvips composite is threaded, vectorized, and (if possible) does tile-wise visibility culling.

The relationship of transformation matrix in image registration and image scale

I am currently doing image registration using the 'Registration estimator' application.
Basically, the application allows the user to register two images using multiple methods and the output includes transformation matrix.
The question is, now I want to register two large images, the size of the two images are 63744*36064 and 64704*35072. It's almost impossible to directly register two images since they are too large.
The methods I use is to first obtain the scaled images for registration and derive transformation matrix and apply that matrix to the original images.
However, I found that even for the same image, different transformation matrices are obtained at different levels.
For example, the transformation matrix for images at sizes: 3984(63744/16)*2254(36064/16) and 4022*2192 is different from 1992*1127 (1/32) and 2022*1096 (1/32).
In that case, I am confused about the relationship between sizes and the transformation matrix. Could anyone give me a hint so that I can precisely register two original images based on the transformation matrix I have for the images at a lower level (smaller size)?
Downsampling an image has direct effect on translation matrix. Suppose for example that there is 2 pixel translation in x direction, downsapling by a factor of 2 changes it to 1 pixel. Whereas its easy to compensate this effect for registering original images, you should avoid downsamplind images if there's memory constrain, since you may lose invaluable key-points used for robust registration. Instead, you can slice your images up into several sub-images, extract the features in each sub-image, combine the features and match them.

What are the correct way to calculate the SNR with these images in MATLAB?

Currently I am trying to figure out the Signal to Noise Ratio of a set of images as a way of gauging the performance of my deconvolution (filtering algorithms). I Have a set of images like the one below, which show the image, before and after the algorithm:
Now, I have discovered quite a few ways of judging the performance. One of these is to use the formula for the SNR of an image, where the signal is the original image and the noise is the filtered image. Another method, as described by this question, goes about figuring out the SNR from the singular image itself. This way, I can compare the SNR ratios that I get for both images and get an all new altogether.
Therefore, my question lies in the fact that, the resources on the internet are confusing and I do not know about the "correct" way of measuring the SNR of these images and using it as a performance metric.
It really depends on what you are trying to compare, and what you deem as "signal" and "noise". In your first method, you are effectively calculating the error(or difference) between image 1 and image 2 where you assume image 2 was tinted by noise but image 1 was not (this is also a sort of signal to distortion ratio). Therefore, this measurement is relative and it measures the performance of your method of transformation from Original to Target (or distortion technique), but not the image itself. For example a new type of encrypting filter generated image 2 from image 1 and you want to measure how different the images are to work out the performance of your filter.
In the second method based on the link you posted, you are assuming that noise is present in both images but at different levels and you are measuring it against each individual image - or in other words, you are measuring the standard deviation of each individual image, which is not relative.The second measurement is usually used to compare results generated from the same source, i.e. an experiment produces N images of the same object in a controlled environment and you want to measure, for example the amount of noise present at the scene (you would use this method to work out the covariance of noise to enable you to control the experiment environment).

Matlab - Registration and Cropping of aligned images from two different sources

Good day,
In MATLAB, I have multiple image-pairs of various samples. The images in a pair are taken by different cameras. The images are in differing orientations, though I have created transforms (for each image-pair) that can be applied to correct that. Their bounds contain the same physical area, but one image has smaller dimensions (ie. 50x50 against 250x250). Additionally, the smaller image is not in a consistent location within the larger image. However, the smaller image is within the borders of the larger image.
What I'd like to do is as follows: after applying my pre-determined transform to the larger image, I want to crop the part of the larger image that is of the same as the smaller image.
I know I can specify XData and YData when applying my transforms to output a subset of the transformed image, but I don't know how to relate that to the location of the smaller image. (Note: Transforms were created from control-point structures)
Please let me know if anything is unclear.
Any help is much appreciated.
Seeing how you are specifying control points to get the transformation from one image to another, I'm assuming this is a registration problem. As such, I'm also assuming you are using imtransform to warp one image to another.
imtransform allows you to specify two additional output parameters:
[out, xdata, ydata] = imtransform(in, tform);
Here, in would be the smaller image and tform would be the transformation you created to register the smaller image to warp into the larger image. You don't need to specify the XData and YData inputs here. The inputs of XData and YData will bound where you want to do the transformation. Usually people specify the dimensions of the image to ensure that the output image is always contained within the borders of the image. However in your case, I don't believe this is necessary.
The output variable out is the warped and transformed image that is dictated by your tform object. The other two output variables xdata and ydata are the minimum and maximum x and y values within your co-ordinate system that will encompass the transformed image fully. As such, you can use these variables to help you locate where exactly in the larger image the transformed smaller image appears. If you want to do a comparison, you can use these to crop out the larger image and see how well the transformation worked.
NB: Sometimes the limits of xdata and ydata will go beyond the dimensions of your image. However, because you said that the smaller image will always be contained within the larger image (I'm assuming fully contained), then this shouldn't be a problem. Also, the limits may also be floating point so you'll need to be careful here if you want to use these co-ordinates to crop a minimum spanning bounding box.

Choosing an area on the image for classification

If anybody is familiar with classification in remote sensing
you know at first we should choose a region on the image and use information on this region to extract statistical parameters.
how can I choose this area of the image in matlab?
I think I found the answer to my own question.
As our friend user2466766 said I used roipoly to have a mask image and then I multiplied this mask with my image using '.*'.
then I extracted nonzero elements of the resulted matrix with the function nonzeros.
and know I have the digital numbers of the region within the polygon in a columnal matrix that can be used to calculate statistical parameters like variance, mean and etc
Try roipoly. It allows you to create a mask image. If you are looking for more flexibility you can use poly2mask.

Resources