Generate color combination from one color - java

I need to generate a color combination (monochromatic, triad, analogous, split, etc) from one color in Java. Just like they do in kuler, only I want to present it in a JSP page). How can I get the RGB value of the colors in the color combination? Is there a formula or API to do this?

I don't know what all those terms mean, but you might find that using HSL Color values may make it easier to find related colors.

Related

Making a qustom EnumChatFormatting Color

Is there a way to make a custom color with EnumChatFormatting, with rgb or hsb? Because i got a gui where i can change the menu color with red(0-255), blue, green also. Now i got the problem to insert that values to EnumChatFormatting anyone got a solution?
It depends. So if you're making a forge mod, it's possible to set the color of your custom GUIs to whatever you want. The ChatFormatting enum is already used in minecrafts code, so you can't change that easily.

Color Combination

I have a grey image containing at least 20 different shades of gray. I would like to apply a certain color without changing it with the exception of the grey affecting the colors brightness slightly. I don't want a very drastic modification to color, only a hint. How would I go about doing this?
I'm using java, however I am more interested in the concept behind doing this.
How would I get the hsv values of a color in Java?
Don't know about HSV, but you could probably use HSL instead. Check out HSL Color for a class that does the conversion.

Detect only red pixels in Java

I need to detect all the red pixels in an image using Java. What 's the best way to do this?
Only supposing a pixel is red when the Red RGB-value is > 200 isn't good enough (see this table).
So is there a better way to do this? Or is there some red-color-rgb algorithm?
Take a look at YCrCb color space.
Simple algorithm: convert your RGB image to YCrCb, extract red channel and make a threshold.
Convert RGB to HSL, and threshold the hue (H) component.
As you suggested, you probably want to do some comparison in HSB space. You'll probably want to define an appropriate rage for all three values based on what your expectations are.
You can use Color.RGBtoHSB to get the values from a given color.
http://docs.oracle.com/javase/7/docs/api/java/awt/Color.html#RGBtoHSB%28int%2C%20int%2C%20int%2C%20float%5B%5D%29

How to replace color of an image?

I want to replace color of an image. For example turn all blue colors to red without any distortion on shape. When i try this i can swap the colors by iterating every pixel, however the shape of the swapped area turns into a flat shape.
example1 input : http://www.tutorialwiz.com/tutorials/changing_color/images/original.jpg
example1 output: http://www.tutorialwiz.com/tutorials/changing_color/images/3.jpg
example2: input output together : http://www.digital-photography-school.com/wp-content/uploads/2009/07/before-after.jpg
The usual way to do this is to use an RGBImageFilter. See the docs for FilteredImageSource for how to use such a filter.
The problem with the issue that you are asking is that a strict color replacement will modify the shape of the image. What you need to do is get a little information on what the shape is. I.e. Find boundaries and shading along the boundaries. My suggestion to you is:
Use edge detection to separate out blobs
Find a blob that fits your demands: i.e. Has a tolerant likelihood for [color]ish.
Identify blobs and filters applied
Recolor the blob and reshade.
IMO: That is the only way you're going to get the result you're looking for.
Some notes: Finding a blob may require some testing to determine how much tolerance you have for blobs and shapes. [Connected Regions].
Another thing: The shading and relative coloring will require you to have a devience for the color you want.
I'm not fully understand the question.
But from the example given, i see that the process of changing blue into red was fail. instead of becoming red, it becomes gray. does color gray is what you mean by flat?
If that so, it looks like color channel error.
to change blue to red, we have to change (0,255,0) to (255,0,0).
I'm not sure if it is the problem, maybe code snippet could help for evaluation. to make sure what is the real problem.

Trying to convert a 2D image into 3D objects in Java

Hey, I'm trying to take a simple image, something like a black background with colored blocks representing walls. I'm trying to figure out how to go about starting on something like this. Do I need to parse the image and look at each pixel or is there an easier way to do it?
I'm using Java3D but it doesn't seem to have any sort of built in support for that...
This might be more compex than you think.
A solution would basically include the following steps:
Edge detection using Java 2D ConvolveOp Filter
Vectorizing the edges into a 2D model.
Extrusion to 3D
Turns out what I really wanted was a height mapper. I mapped each pixel to a certain height based on its gray-scale RGB value. If I wanted color to be independent of height, I would have two images, one with the gray-scale height map and another with a colored image of what I want the, in this case, room to look like.
As for recognizing colors from an image as a specific object other than by pixel, definitely requires something more complex. A friend was suggesting something like painter's algorithm for something like that. However, at least for me, that was being the scope of my application.

Categories

Resources