Selecting dark parts of a picture with fuzzy border - gimp

I am struggling with the fuzzy selection tool in gimp - try to make the dark part in the picture black while retaining the dark parts below the light border - any advice how to achieve that?

Not with the fuzzy selection or the color selection :)
Very often the best way is to use the image itself (or a copy). If I understand you, you want to select the top dark part (which is many shades of grey), but not the bottom one. In practice we want an image where the selected parts are white and the un-selected are black, so
duplicate the layer
Color>Desaturate (if the image has colors)
Color>Invert
Filters>Blur>Gaussian blur (around 12px in the image you show). In Gimp 2.10, the median blur can also give interesting results)
Use Threshold to make the white very white and the black very. Use the threshold value that keeps a continuous black line across the picture
Bucket fill the lower white part with black (in Gimp 2.10.10 you can use the new Fill by line art detection option of the bucket
Open the Channels list, right click on any f the R, G or B channels and Channel to selection.
Back to the Layers list, hide or delete the work layer, and select the initial layer to continue.
Using the selection with the Curves tool to set the black and white points on the top part:

Related

How do I set tint color only for non white parts of the UIImage?

Simple I have UIImageView icon with two people and it looks like this:
but when I set tintColor to red it looks like this:
Is there any way to avoid covering every non zero-alpha pixel? I need to show the tie really there. One time I need people red, other time green.
The icon is simple png file. Rounded circle is simple background color of UIImageView. So the part of the image with tie cannot be zero-alpha.
Is there any way to achieve such effect WITHOUT creating images for every color?
This was similar to another idea I had been playing around with, so I did a little more fiddling...
Starting with these 3 images:
and then using them as .withRenderingMode(.alwaysTemplate) to give the desired colors... and then layering them via CALayer to get:
and an "exploded" view for clarity...
Create an image where the "people" are 100% transparent - effectively "holes" in the image.
Set the background color of the UIImageView to be the "fill" color.
You can still mask it with a circle (CAShapeLayer, for example), if you don't want a white bounding-box as part of the image.
Original images:
https://i.stack.imgur.com/eFrmB.png
https://i.stack.imgur.com/2GNDX.png
Use the CISpotColor filter:
https://developer.apple.com/library/content/documentation/GraphicsImaging/Reference/CoreImageFilterReference/#//apple_ref/doc/filter/ci/CISpotColor
This allows you to specify a color in your image that is to be changed into another color. Thus, since you know the original color of the tie and the background, you can change either of them, or both, in a single move.

iOS: how to add alpha to three layers of background

I want something like this:
There are three layers of view, first is the background.
Then there is an alpha layer,
and another alpha layer contains "SAVE LOAD"
My question is how to set the alpha value and background color for the top 2 views so that it can display this desired layering. Many thanks!
From my point of view, it looks like
50% alpha on black
100% alpha on dark green
Yet, your designer might be a better fit to ask.
Edit:
You might have to play with the alpha on the black a little to get a good match without detailed information from your designer. As to the dark green, I cannot see any transparency, so I'd just go for opague to keep the alpha parts low for the graphics engine.

Check white grease on the surface of white part by image processing

Now I am doing a project about image processing. I want to check if there is any white grease on the
surface of a white part.
My method is to capture the image of part containing white grease and then process the image
to check if there is any white grease.
The problem is that the color of part and grease are almost the same (about 99%).
Therefore, I can't separate them and can't detect the grease.
Could you suggest me some ways/methods to check the white grease on the white part?
Maybe something like what kind of light, how to set up light, etc...
Thanks!

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.

Placing an image in a specific region of another image

Here is an oval, and a box
The goal is to place the oval inside the green box.
If you imagine the green box on the bottom to be your bounds, the top image can be placed anywhere inside the green box. The oval cannot flow outside of the green box.
Input is just the two images and I'm told to "put the red oval in the green box." If it is not possible (eg: the oval is too big), nothing happens.
It is trivial to do it by hand in a image editor: just drag the top image over the green box and make sure it doesn't flow out the sides.
How should this problem be approached?
There are a variety of ways of doing this and choosing one depends on problem constraints. In the simplest case, if you know the exact colours of the red, blue, and green, and know that none of the shapes are rotated the solution is simple. First binarize the image so that only one object is separated (oval or rectangle) then find the highest,lowest,leftmost,and rightmost point for that object. Repeat for the other object. That information will tell you if the ellipse can fit in the rectangle.
If those constraints are too rigid, then you will probably want to use blob detection. Perhaps cvblob or cvblobslib. They can handle the much more general case of varying colours and orientations.

Resources