Does anybody know how does it work and how to do it using OpenCV? Laplacian can be calculated using OpenCV, but the result is not what I expected. I mean I expect the image to be approximately constant contrast at background regions, but it is black, and edges are white. There are a lot of noise also, even after gauss filter. I filter image using gaussian filter and then apply laplace. I think what I want is done by a different way.
相关问题
- How to get the background from multiple images by
- Try to load image with Highgui.imread (OpenCV + An
- CV2 Image Error: error: (-215:Assertion failed) !s
- Is it a bug of opencv RotatedRect?
- How do I apply a perspective transform with more t
相关文章
- How do I append metadata to an image in Matlab?
- opencv fails to build with ipp support enabled
- Code completion is not working for OpenCV and Pyth
- Face unlock code in Android open source project?
- Python open jp2 medical images - Scipy, glymur
- How to compile a c++ application using static open
- On a 64 bit machine, can I safely operate on indiv
- Converting PIL Image to GTK Pixbuf
Laplacian of Gaussian is an edge-detection filter; the output is 0 in constant ('background') regions, and positive or negative where there is contrast. The reason why you're seeing black in the background regions is because OpenCV is just giving you the raw output; the kind of image you're describing (gray on background, with positive / negative edges in black or white) is produced after scaling the output into an appropriate range.
The output range varies depending on the actual kernel used, but it's always going to fit in a
(-max, +max)
range around zero wheremax
is the maximum output magnitude of the filter kernel; to get the "typical" output image you need to scale that into a(0, 1)
range (or(0, 255)
if you're using 8-bit images).You can perform the necessary scaling using the
cvScale
function, with1/(2*max)
as the scale factor and0.5
shift. (Or for 8-bit images use255/(2*max)
scale and128
shift.)