So I have no idea how I should be doing what I want do so I'll explain as best as I can.
http://i.stack.imgur.com/j65H8.jpg
So imagine that entire image is a 2d square 128x128 and each color I want to apply a texture to that part of the 2d square. Also I want it to stretch as well so Red, Aqua, Green and Purple never stretch in any direction but Pink stretches all directions and then Grey, Yellow, Black and Orange stretch in the longest direction (grey/orange = width expands, yellow/black = height expands). When stretched it should look like this:
http://i.stack.imgur.com/wJiKv.jpg
Also I am using C++.
Related
Image negative effect is typically done like this:
pixel = rgb(1, 1 ,1) - pixel
but if the pixel color is close to gray, than:
pixel = rgb(1, 1, 1) - rgb(0.5, 0.5, 0.5) = 0.5
That's not a problem and it's how it should be, but for me it is, I am making a crosshair texture in my 3D game, which will be drawn in the center of the screen and I want it to have negative effect, reason for it is clearity, if I were to make crosshair white, it would not be visible when looking on white objects (I know I can make it with black outline so it is visible, but thats ugly), but it still has problems for grayish colors as I described, what can be done to fix that?
I would like to know if there's a simple way to change a color, say from a shade of grey to white, within an area of interest that would be determined from the image frame on the outside and a contour, returned from the opencv contour function. I mean, let's say I have an image with a black background and 2 circles, one inside the other, between the circles the color is a shade of grey, and inside the inner one is black. I found the outside circle contour, now I want to change the outside black for white.
In OpenGL, I made a sphere and gave every Fragment the Color of its normalized position. The sphere is right at the origin so the sphere should be covered with smooth color gradients between red, green, and blue, while on every axis, the color is pure(x - red, y - green, z - blue).
but not like I expected i see this shape when i look down the Z/Blue Axis
I played around a little and compared the gradients between the different colors
(looking down the x axis with zero red color)
In this image, it looks like the Green color is somehow more dominant than the blue, as if it was sprayed on top of it. Also the Blue seems to be deminished by the black.
(looking down the y axis with zero green color)
In this image there seems to be a smoother gradient but i´d still say there is more red than blue in the image but this might be my individual perception and the picture is not perfectly symmetrical aswell.
(looking down the z axis with zero blue color)
To me it looks like Green and Red are more dominant than blue for some reason.
But what originally brought up this question is the weird hard gradient i got (first image). I dont think it is a bug in my shaders, because i never treat any color individually.
What could cause this behaviour?
PS: I have not implemented alpha yet and i am not using alpha anywhere in my shader (where i use a vec4 for color, the 4th component is always 1.0)
I like to write a function that gets 4 colors sitting in the corners of an image. The colors are 16 bit RGB. My job is now to output an 16x9 image that represents the gradient of these colors. The simplest case would be someone passes the color red for the topleft and bottomleft corner and green for the topright and bottomright corner. The image should now show the smooth transition from red to green :) Which algorithms would you suggest ? Help is really appreciated :)
Basically I need these operations.
createLinearGradient(horizontal)
createLinearGradient(vertical)
createLinearGradient(diagonal)
createBilinearGradient() there is a good picture about this in wikipedia
http://en.wikipedia.org/wiki/Bilinear_interpolation
But someone told me I could do everything with just one algorithmus
The texture I'm using is doing filtering for the edges but it creates gaps for the extrusion.
In the photo
The yellow shape is the texture, the white shape is an extrusion and the red shape is the background.
The red background should not be seen between the face, the yellow shape, and the extrusion.
What approach should I use?