Equalize a white balance, colors, contrast and brightness in multiples images - beanshell

I just discovered for myself the new word of imageJ
Found this example of histogram matching: Histogram match between two images
Can some one help to make a script to equalize white balance, colors, contrast and brightness from one "good picture" to bunch of other pictures.
Let see this example, I have three timelapse pictures:
Bad contrast (sun reflection)
Different White Balance:
"Good" image, I would like others to have contrast/brightness/white balance like this one:

Related

Gimp image color mode

I use Gimp, I have a color pallet which contain 556 colors (embroidery related) , but I don't know how to use all those colors in my working image because the index color mode only support maximum 256 colors... what's the solution I have?
All the places in Gimp where the number of colors is limited seem to have an upper limit of 256 colors: indexed mode, color palettes, Posterize filter...
If you want to limit yourself to the 556 colors of your palette, create an image with 556 squares, each painted with one of your 556 colors and save it somewhere. Then when needed open it in Gimp together with your work image, and use the color picker to sample colors from it.
If you want to shoehorn an existing image into your 556 color palette, then you can use the ImageMagick toolbox for this:
Prepare an image with only your 556 colors (as a PNG file, you have to avoid JPEG because the compression will introduce extra colors). This will be your "color map". There is no need for a special format layout, the only important thing is that it contains only your 556 colors (to check in Gimp: Colors > Info > Colorcube analysis, with IM: identify -verbose ColorMap.png and check the Colors line)
Execute the command
convert Source.png -remap ColorMap.png Reduced.png
where:
Source.png is your original image, with likely thousands of colors. It can be any format (JPG, PNG, TIFF...)
ColorMap.png is the map you prepared above
Reduced.png is the color-reduced image. It has to be in a format where pixel colors are preserved exactly (so, PNG in your case, for simplicity(*))
In recent versions, convert is replaced by magick or magick convert
So for instance, starting with:
And applying this 512-colors colormap
You obtain this:
Note that the color-reduced image can contain much less than the 556 colors (190 colors in the image above, despite the 512 colors colormap) (you won't have bright reds in Mona Lisa).
The whole thing is documented here.
After trying the process a few times, I find that given a good palette it works quite well, so if your 556 colors make up good palette, you could make your workflow a lot simpler, by working in full RGB all the time, and then converting the image to 556 colors.
(*) TIFF and WebP formats also support exact colors/lossless compression, but they still have variants that will do a JPEG-like compression that will change the colors, so they must be used with care.

How can I find the amount of pixels in part of an image?

I have an image and I want to see how many pixels are in different parts of the image. Is there a software I can use to do this?
In Gimp, the "Histogram" dialog applies to the selection, so the pixel count displayed is the pixels in the selection (weighted by their selection level):
In the image below the selection covers the black circle which has a 100px radius. The Pixels value is close to 100²*Pi (314000 instead of 314159).
The Count is the number of pixels between the two values indicated by the handles at the bottom of the histogram.
Of course the selection can have any shape and be obtained with various tools.
I assume PS has something equivalent.

Finding the length of a line through every pixel

I have a raster image with multiple polyline feature classes over it. The lines are not overlapping but they are in multiple different orientations. For every pixel in the raster, I want to calculate the length of the line through that pixel so that the result would be a raster with cells assigned a float value of zero to 2^0.5 times the cell size. What's the best way to do this? I'm using ArcPro with an advanced license.
You can have a look at the answers to a similar question here (using R --- but you have a license for that too)
https://gis.stackexchange.com/questions/119993/convert-line-shapefile-to-raster-value-total-length-of-lines-within-cell/120175

Lesscss: Why spin(#000,180) is returning #000?

I need to know how to get the inverse color by lesscss.
Example: I have #000, i need #FFF.
And i need the detail explanation of spin(). And necessary links where i can see a color wheel where i can understand how spin() works.
Thanks.
Why it is not working as you expect
The spin() function only deals with hue (color), not value (grey scale changes are a value change). Take a look at Figures 9 and 10 on this page from North Carolina State University's site. Those figures help show the difference. The spin() function is rotating only in the two dimensional space of the hue circle of color, not along the axis of the third dimensional space dealing with saturation; i.e. the gray scale itself, which is what differentiates white from black, both of which have no color saturation).
This is why on the LESS site we read of spin() (emphasis added):
Note that colors are passed through an RGB conversion, which doesn't
retain hue value for greys (because hue has no meaning when there is
no saturation)
And
Colors are always returned as RGB values, so applying spin to a grey
value will do nothing.
Getting what you want (Color Inversion)
See #seven-phases-max's answer.
The spin function changes the Hue property of a colour. Shades of grey (incl. white and black) are achromatic colours (i.e. they have the same "undefined" hue value).
To simply invert a colour use either difference function:
difference(white, #colour)
or the simple colour arithmetic:
(#fff - #colour)

Input parameters of CITemperatureAndTint (CIFilter)

I fail to understand the input parameters of the CIFilter named CITemperatureAndTint. The documentation says it has two input parameters which are both a 2D CIVector.
I played with this filter a lot - via actual code, via Core Image Fun House (example project from Apple - "FunHouse") and via iPhoto.
My intuition says that this filter should have two scalar input parameters: One for the temperature and one for the tint. If you look at the UI of iPhoto you see this:
Screenshot of iPhotos Temperature and Tint UI:
As expected: One slider for the temperature and one for the hue. How did apple "bind" the value of each slider to a 2D-Vector? akaru asked this question already but got no answer: What's up with CITemperatureAndTint having vector inputs?
I have opened a technical support incident at Apple and asked them the same question. Here is the answer from the Apple engineer:
CITemperatureAndTint has three input parameters: Image, Neutral and
TargetNeutral. Neutral and TargetNeutral are of 2D CIVector type, and
in both of them, note that the first dimension refers to Temperature
and the second dimension refers to Tint. What the CITemperatureAndTint
filter basically does is computing a matrix that adapts RGB values
from the source white point defined by Neutral (srcTemperature,
srcTint) to the target white point defined by TargetNeutral
(dstTemperature, dstTint), and then applying this matrix on the input
image (using the CIColorMatrix filter). If Neutral and TargetNeutral
are of the same values, then the image will not change after applying
this filter. I don't know the implementation details about iPhoto, but
I think the two slide bars give the Temperature and Tint changes (i.e.
differences between source and target Temperature and Tint values
already) that you want to add to the source image.
Now I have to get my head around this answer but it seems to be a very good response from Apple.
They should be 2D vectors containing the color temperature. The default of (6500, 0) will leave the color unchanged, as described here. You can see what values for color temperature give you which colors in this wikipedia link. I'm not sure what the 2nd element of the vector is for.