ImageJ: enhance brightness/contrast of a selected region - imagej

How do I enhance the contrast/brightness of only my selected region and not the entire image. I am trying to use freehand selection tool, but unsure how to proceed afterwards.
Thanks in advance,
KL

If you click the Apply button of the Brightness & Contrast dialog, it will alter the pixel values of the selected region (and only the selected region) to match the current Brightness & Contrast settings. This will achieve your desired effect, if what you want is to visualize that region at a different B&C.
Beware of performing any image analysis after that point though, since the raw pixel values will differ and you will then be comparing apples to oranges.

If you change the image type to RGB and then it will only change the contrast/brightness of the selection. (After changing the contrast you can change it back to 16bit)

Related

Cropping image By selecting Object and color matching

We are developing an app where we need to crop an image according to the selecting object area. User will draw a line and we need to select the object and crop it .This crop need to be like the app: YourMoji
So far we have tried to get the color of the pixels along the line and then comparing those with the color of every pixel in the image and making a path from it to clip the image. But the almost going no where.
Is it possible through this way to crop an image or we are going in the wrong way? Can anyone provide a way to do this Or suggest a way to modify the way we have worked so far? Any advice and suggestions will be greatly appreciated!
Thanks in advance.
I guess what you want is the image segmentation algorithm called Graph Cut.
Here are two Github repositories, hope these would help:
GraphCut
GrabCutIOS
I'm not exactly clued up on image manipulation, but the first algorithm that comes to mind is something like this:
Take the average of the pixels in the line (as you have)
Since you appear to want faces, you might want to weight reds and blues over green. Not much green in faces of any skin tone.
For each pixel, if the colour is within a given threshold outside of your selected average, remove it / make transparent.
Perhaps the closer to the original line (or centroid), the less strict the threshold becomes.
I'd then provide the user with some tools for:
Sensitivity: how large the threshold is
Eraser: to remove parts of the image that your algorithm missed
Paintbrush: to replace parts of the image that your algorithm incorrectly removed.

Adding color to selected areas in ImageJ

I want to measure the area of a group of clumped cells with blurred margins. I cannot set a threshold and measure the ROIs as the edges are not clear. I have to manually select the ROIs. I would then like to color in the ROIs of same area with one color so that it is easy for visualization. I want to show that that in my tissue sample there are cells of different sizes.
Please suggest how I can fill the ROIs with the same area with a color. Is there a better way to do this?
Thanks
There's a macro called ROI Color Coder that colors measured ROIs according to size. That might be close to what you want.
The easiest way to add it to ImageJ is to use the Fiji distribution of ImageJ and activate the "BAR" update site. That way you get any updates automatically.
Check out the ImageJ forum too -- it's a good place to get answers about using ImageJ.
Hope this helps.

How to apply chroma key filter with any color to live camera feed ios?

Basically I want to apply chroma key filter to ios live camera feed but I want user to pick the color which will be replaced by another color.
I found some examples using green screen but I don't know how to replace color dynamically instead of just green color.
Any idea how can I achieve that with best performance?
You've previously asked about my GPUImage framework, so I assume that you're familiar with it. Within that framework are two filters, a GPUImageChromaKeyFilter and a GPUImageChromaKeyBlendFilter. Both will key off of whatever color you specify via the -setColorToReplaceRed:green:blue: method, with a threshold set using the thresholdSensitivity property.
The former filter merely turns areas matching the color within the threshold to an alpha of 0, with the latter actually doing a blend against another image or video source based areas of the input image or video that match. The FilterShowcase example application shows how to do this for green, but you can set the keying color to anything you want.

imagej status bar coordinate display

Does anyone know of a way to increase the number of digits displayed in ImageJ's status bar? This is normally not a problem if pixel coordinates are displayed, however once a scale is applied only two digits in the display is no longer sufficient depending on the scale factor.
ImageJ displays the coordinates of the cursor position with the help of ImagePlus#getLocationAsString(x,y), which in turn uses IJ.d2s(double n) to format the coordinates. The problem would be solved if IJ.d2s(double x, int significantDigits, int maxDigits) was used instead.
Feel free to write to the ImageJ mailing list, where Wayne Rasband (the developer of ImageJ 1.x) will likely pick it up and add the feature if he thinks it's appropriate.
As a workaround, you might want to press the alt key while moving the mouse, switching to pixel coordinates instead of calibrated coordinates in the status bar (see here).

Best approach for customizing image with text on ios

I have a project to customize clothes ,let say a t-shirt, that have following features:
change colors.
add few lines of text ( <= 4) and change the font from a list.
add image or photo to the t-shirt.
rotate the t-shirt to custom back side.
rotate the image and zoom in/out.
save the result as a project locally and send it to a webservice ( i think to use NSDictionary/json ).
save as an image.
so my question is :
Should I use multiples images to simulate colors changes. Or should I use QuartzCore ( I am not an expert in QuartzCore but if I have to use it I'll learn). Or is there a better approach for this ?
Thank you.
The simple way to do this is to render the T-Shirt image into a CGContext, then walk the rows and columns and change pixels showing a "strong" primary color to the desired tint. You would take a photo of a person wearing a bright red (or other primary color) t-shirt, then in your code only change pixels where the red color has a high luminance and saturation (i.e. the "r" value is over some threshold and the b and g components are low).
The modified image is then going to look a bit flat, as when you change the pixels to one value (the new tint) there will be no variation in luminance. To make this more realistic, you would want to make each pixel have the same luminance as it did before. You can do this by converting back and forth from RGB to a color space like HCL. Apple has a great doc on color (in the Mac section) that explains color spaces (google 'site:developer.apple.com "Color Spaces"')
To reach your goal, you will have to tackle these technologies:
create a CGContext and render an image into it using Quartz
figure out how to read each pixel (pixels can have alpha and different orderings)
figure out a good way to identify the proper pixels (test by making these black or white)
for each pixel you want to change, convert the RGB to HCL to get its luminance
replace the pixel with a pixel of a different Color and Hue but the same Luminence
use the CGContext to make a new image
If all this seems to difficult then you'll have to have different images for every color you want.

Resources