Ask Your Question
0

cv::Scalar color with transparent

asked 2016-04-19 01:04:59 -0600

AdamIB gravatar image

updated 2016-04-21 04:32:52 -0600

Hi,

My question is it possible to draw rectangular/circle above image with transparent color let's say transparent green (see water molecules) using cv::scalar? if not is there any alternatives to do so?

OK, I'm trying to edit my question, I've done the segmentation but when I used cv::scalar for the color it gives me solid background color RGB which means the object will disappear. So my objective is to make the segmented area looks like the attached picture as green tint so is there any tool in opencv that can achieve this?

Thanks

image description

thanks

edit retag flag offensive close merge delete

Comments

2

opencv != photoshop. alpha has no meaning in computer-vision. you're probably using the wrong tool for your job.

berak gravatar imageberak ( 2016-04-19 02:51:51 -0600 )edit
1

There is a lot more going on there than just transparency. There are also highlights, a bit of shading, and a couple of light sources.

jmbapps gravatar imagejmbapps ( 2016-04-19 08:50:57 -0600 )edit
3

you could:

Mat chan[3]; split(img, chan); // draw into green channel only merge(chan,3,img);

berak gravatar imageberak ( 2016-04-21 04:42:18 -0600 )edit

Ok thanks for the clarification, so let's say I'm having this polygon cv::fillPoly( image, ppt, npt,1,color, lineType );

as you can see the color is an object for cv::Scalar so when i tried the split and merge it was applied for the whole image, and when I ignore it (color) it gives black for the detected area, do you have any idea? thanks a lot for the reply Berak

AdamIB gravatar imageAdamIB ( 2016-04-21 18:23:37 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-04-24 03:09:18 -0600

AdamIB gravatar image

"try paint the poly to a separate image with black background. then for each pixel: if polyimage-pixel isnt black: image-pixel = 0.5imagepixel + 0.5polyimage-pixel. instead of 0.5 you can use any transparency factor x and (1-x) "

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-04-19 01:04:59 -0600

Seen: 3,399 times

Last updated: Apr 24 '16