How to change pixels position in image python - image

I'm trying to read an image and to change pixels positions like (x-a), and (y-yb) in python. Does anyone have any idea how to do that?

Related

How to reduce the line thickness of an imported image in inkscape

I've opened the following image in Inkscape. I want to reduce the thickness of the black lines/curves in it.
Since this is not a vector image, I am not sure how to reduce the thickness
of the lines in this image.
Could someone please help me with this?

Binarized grayscale image contains too much noise

I currently have a digital pathology image like this:
Firstly I turn the image into grayscale using the following codes:
img=imread('DigitalPathology8.png');
figure;
imshow(img)
hsv=rgb2hsv(img);
s=hsv(:,:,2);
And I got this grayscale image:
While I try to binarize this grayscale image using the following codes:
bw = imbinarize(s,'global');
figure
subplot(2,1,1)
imshow(s)
subplot(2,1,2)
imshow(bw)
I got the image like this:
What's wrong with my codes? When I applied the same algorithm to other images like this:
I could get the binarized image which only blue cells are white and other cells including backgrounds are black. So I also expect the same result after I applying the same codes to the first image I mentioned.
Could someone please help me out?
You should better use the rgb2gray()(look here) for your conversion:
grey=rgb2gray(img)
This should get you something like this:
Instead of global thresholding, i would recommend more sophisticated methods such as Otsu, which will get you much better results:
However, if you only want to extract the blue cells instead of a simple thresholded version of your image, you should use a totally different approach like MaxEntropy on the grayscale image. This will give you something like this:
and this
This tresholding method does not seem to be included in matlab, but a plugin can be found.
You could also try a total different approach to detect the blue dots by thresholding based on color similarity:
With this approach you would set each pixel to white which has a color distance to the blue color which is smaller than a given threshold. This should give you something like this (red markings represent the foreground of the image):
Reference color:
For this approach i took the RGB color (17.3,32.5,54.5) as reference color, my max distance was 210. If you have ImageJ, you can this approach interactivly, a while back i wrote a plugin for that.As you can see, this approach also detects wrong cells, which is caused by the high value for the distance and the choosen reference color. This errors may be minimized by selecting a more appropriate reference color and smaller distance values.

Matlab GUIDE blurs image?

my plan is implementing an image in a Matlab GUIDE figure. Somehow the output is always blurred (see screenshot). On the left you can see the image in Photoshop on the right in Matlab - notice how the font and other parts become blurred.
I experimented with JPEG and PNG file formats (no compression), I also tried various pixel sizes(resolutions smaller, same and bigger as the actual position of the image) and DPI(values between 30-300) settings, because I expected some scaling issue. Somehow I am stuck - Looking forward to your input!
Thank you,
Florian
Screenshot of the issue: http://s1.bild.me/bilder/260513/6875414Screen_Shot_2014-06-29_at_23.19.34.png
Most probably the reason for the blur is interpolation.
If the axis size you allocated for the image is different from the size of the image MATLAB will resize the image to occupy the whole area.
In order to prevent any interpolation you must set the axis dimension to be the image dimension.

Replace all solid colors in a UIImage

I'm trying to perform image recognition via a SIFT algorithm using solid shapes.
To improve the performance, I would like to take the image (captured from an iOS camera), make all non-light colors a dark red and make the remaining pixels transparent.
An example of a before and after of what I'm trying to achieve is attached in the images on this question.
Assumption: the images are always solid-black shapes and printed on plain white paper
Can someone please help me with this or point me in the right direction?
As provided in this code, you can simply iterate over the pixel data and compare each color of the pixel with the value you want to filter. But before you should maybe apply some filters for better results.

MATLAB Image cropper for multiple images?

I have 19 images and I would like to be able to crop them all the same way, cropping off the same area on each image. But I need to look at the first image and determine what part of the image I want to crop. Then I would like to apply that crop to all the other images. My idea is that I could save the four corner points from the first crop and then iterate though the other 18 images using the 4 points to properly set up the cropping. Does this seem like a good approach? Or does anyone know of a Matlab program that does this already?, I search already.
Use IMCROP function from Image Processing Toolbox.
For the first image run it interactively and save the selected rectangle coordinates as a variable (rect):
[im_cropped rect] = imcrop(im);
Then for other images apply that coordinates:
im_cropped = imcrop(im, rect);

Resources