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);
Related
I was curious how would I move pixel with particular coordinates to another location? Or in other word, change the locations of pixels in the image? And then output the changed image again.
using Images
img_lab = rand(Lab, 10, 10)
For example pixel in (1,1) move to (2,3) and overwrite the existing pixel.
Later I want to implement this idea to real images and to all pixels in the image.
img_lab[2,3] = img_lab[1,1]
The image is just a matrix, and you manipulate its elements the same way.
I have an image.
I have several small functions of attributes of that image, that I'd like to overlay like a spark line into the image. Is there a straight forward way to do this?
Obviously, I could write my own graphing routines, to generate rasterized graphics objects, and overlay them on the image. I was hoping for something a bit more straight forward.
Here's what I'm looking for (roughly)
I = imread('cameraman.tif');
imshow(I);
figure(2);
plot(I(128,:));
* insert some magic here *
and generate output like the below. In this case, I'm plotting the grayscale values across the middle of the image. In general, I'll want to be able to put the sparkline plot anywhere in the image, with any orientation. But, this is getting generally to what I'm interested in achieving.
I have video frames with elliptical objects in them. I'm trying to detect the main ellipse using regionprops and it works just fine.
However, since I want to speed up the process, I want regionprops to only look for those ellipses in a certain area of the image. I can crop the images each frame, to only have the relevant area left, but I would rather have regionprops look only in specified areas.
Is such an option possible?
Regioprops uses label matrix provided by bwlabel(bw_image) or just logical(grayscale_image) if you suppose that there is only object in the image. To make regionprops process only a part of image you should set irrelevant part of the label matrix to zero.
I am using http://imageresizing.net/ tools to create an editor.
The user can crop and rotate, but when they crop first and then rotate they lose the correct crop coords because the image coords have changed
for example, given a 100x100 image with a crop of the top left 50x50 pixels would then get rotated clockwise and now shows the crop as the original bottom left 50x50 pixels of the source image.
another example with images:
step one crop:
step two rotate:
coords haven't changed, but now it is no longer the proper crop area
does anyone know of a way to have the crop be relative to the original instead of the origin point?
Are you building something like StudioJS?
StudioJS uses ImageResizer.js to manage the command string and translate co-ordinates.
Consider a workflow where your user crops, rotates, and then re-crops the image. To preserve the original crop you will need to translate the coordinates in javascript. ImageResizer.js can do this.
I'm using the custom UI editor to upload images to a custom ribbon tab. I need the images to look like this:
but currently they are looking like this:
These images are directly from Microsoft shapes. I tried saving them the shapes directly but they were really messy. There must be a way to get the shapes perfect as per the first image - I'm just not sure how.
Any help would be appreciated.
Your images need to be saved in exactly 16x16 pixel size. Anything else, and they will be scaled to fit a 16x16 area, and thus have fuzzy lines.
Your top image (the rectangle) measures 16 pixels wide by 10 pixels tall. If that is the extent of that image, then when you import it, it will get stretched. You need to also include the white (or empty) space around the image (in this case, above and below) when you create the image.
The example above shows the exact same 16x10 px rectangle, in two different formats. The top image included the white space above and below the rectangle and was saved as a 16x16 px image. The bottom image only had the 16x10 px rectangle and was saved as a 16x10 px image, so it was stretched by the UI editor to fit the 16x16 available space.