kkduncan / SaliencyDetection

Saliency detection in images and videos.
4 stars 1 forks source link

minor issues #1

Closed bootchk closed 8 years ago

bootchk commented 8 years ago

1) typo in CannyEdgeDetector.h

`#ifndef CANNYEDGEDETECTORH

define CANNEDGEDETECTORH`

2) In CannyEdgeDetector.cpp the data flow of smoothedImg seems to have no effect:

`/ * Perform Gaussian smoothing / smoothImage(src, smoothedImg);

/*
 * Compute the first derivative in the x and y directions
 */
calculateDerivatives(src, deltaX, deltaY);`

In other words, you create smoothedImg but calc derivatives on the src.

3) Is there a spurious edge effect on the right and bottom of SaliencyTestOutput.jpg ?

Also I didn't fork but derived another repository: https://github.com/bootchk/saliencyLibrary.git , where I have made some trivial changes to clean up the code (while I am trying to understand it, and hopefully wrap it in a Gimp plugin.)

I started here when I saw you forked resynthesizer. It is curious that repeated applications of resynthesizer (from an image to itself) tends to obliterate unique, man-made features (salient?) whereas your algorithm seeks to find those features.

What I am hoping to do as a plugin is image summarization or autocrop, by thresholding the saliency map and then cropping the original to the bounding box of that.

I don't see that this code operates at all scales (Gaussian pyramid) as you say in the paper, but possibly I just misunderstand.

kkduncan commented 8 years ago

Hello. Thanks for your interest. Here are my responses to your issues: (1) - Fixed (2) - I intend to fix. The function calculateDerivatives should be performed on the smoothed image. I haven't worked on this code in a while and it is not my best. (3) - No, that isn't a spurious effect.

I appreciate that you're interested in this work. This is not the full implementation of what I published in the article. At the time when I used Gaussian pyramids (a few years back), my algorithm wasn't optimized to exploit parallelism etc. so it was slower than the single scale approach. However, this can be easily implemented.

I intend to make changes to this code in the near future... unless procrastination gets the better of me.

Please let me know if you have any other issues or concerns.

Thanks in advance.

kkduncan commented 8 years ago

Also, LegacySrc contains some really old (and possibly bad implementations) of my saliency algorithm. You can find an old implementation of GaussianPyramid there but I would suggest using OpenCV's version instead.

bootchk commented 8 years ago

Thanks. I am interested in multi-scale because in the past I was reading and experimenting with code for bidirectional similarity and struggled to understand how results from one scale were then used at different scales. Thanks for pointing me to places to read. Multi-scale is not my main concern, unless it is becomes necessary for good performance.

I also thought about testing your code with OpenCV version 3, which should take advantage of OpenCL and multiprocessing. But I don’t yet understand whether the heart of your algorithm is amenable to that, and I quickly found that the preamble which obviously uses OpenCV is a small part of the run time. I just learned that v 3 was only ready a few months ago, its hard to keep OpenGL, OpenCL, OpenCV straight.

Another question: the algorithm samples randomly, but must it iterate in the order which the samples are generated? If not, you generate the sample points (quads of coordinates), then sort them, then process them in sorted order, to take advantage of memory locality. Again, I have a very shallow understanding so far.

Yes, procrastination and other priorities. Don’t invest too much in humoring me because what I hope to do is not necessarily what I will have time for.

On Apr 1, 2016, at 12:24 PM, kkduncan notifications@github.com wrote:

Also, LegacySrc contains some really old (and possibly bad implementations) of my saliency algorithm. You can find an old implementation of GaussianPyramid there but I would suggest using OpenCV's version instead.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/kkduncan/SaliencyDetection/issues/1#issuecomment-204459015

kkduncan commented 8 years ago

Sorry for the delay. To answer your question, the random sampling works by first choosing a point from anywhere within the image bounds, then it chooses 3 other points within a neighborhood M around that point. You can sort the points if you'd like. That shouldn't affect the algorithm.

Eventually, I'll do an overhaul of that algorithm given the knowledge that I have now. When I first wrote it, time was an important issue therefore its implementation may not have been the best.

Again, thanks for your interest.

bootchk commented 8 years ago

Yes, sorting did not help, I did try it.

I am overhauling it myself. See my repository libsaliency (work in progress) and gimp-plugin-lib-saliency (which is a front end to the library), both probably broken at the moment.

It has been a learning experience. After I wrote the front end, I found that the results were not what I expected for the grayscale of a color image (for example, a yellow stripe on a black highway was not salient, and a leafy area was salient. My expectations are probably wrong) So I am making it more general (use color gradients), and then I probably will try a gaussian pyramid. I have been reading your legacy code.

The issue with 'spurious saliency right and bottom' was a black line in your bike image that I hadn't noticed and cropped out for further testing.

There are several issues I have found and would eventually like to discuss, in whatever forum you prefer, when you get some time.

Finally, I am intrigued that your first paper (I haven't read it) computed as you say using brute force, and wondering whether that might be similar to the algorithm for computing 2D gaussian pyramids, which I understand is novel and efficient. And wondering if either algorithm is amenable to multiprocessing.

kkduncan commented 8 years ago

Yes, your expectations may have been a bit off for this form of saliency because of the image feature it compares. If you want to find color saliency, the algorithm would have to be altered to check that. My work only focused on the differences between edge gradients of a gray-scale image.

As far as discussing the issues you found, I have no forum preference. Just let me know what works best for you.