Question about how to generate superpixels of raw images
GWwangshuo opened this issue · comments
Hi, I am attempting to run your code on several datasets. However, I cannot figure out how to generate the superpixels files for these input images. I have carefully checked the preprocessing-scripts/selections.py
and found the reseeds_cli.exe
is needed.
I followed the instruction in https://github.com/davidstutz/seeds-revised to install reseeds_cli
on Ubuntu, but it seems the arguments required are not the same with yours, e.g., there is no argument --index
.
$ ../bin/reseeds_cli --help
Allowed options:
--help produce help message
--input arg the folder to process, may contain several
images
--bins arg (=5) number of bins used for color histograms
--neighborhood arg (=1) neighborhood size used for smoothing prior
--confidence arg (=0.100000001) minimum confidence used for block update
--iterations arg (=2) iterations at each level
--spatial-weight arg (=0.25) spatial weight
--superpixels arg (=400) desired number of supüerpixels
--verbose show additional information while processing
--csv save segmentation as CSV file
--contour save contour image of segmentation
--labels save label image of segmentation
--mean save mean colored image of segmentation
--output arg (=output) specify the output directory (default is
./output)
Could you please offer the executable file reseeds_cli.exe
or give me some hints about how can I get access to this file? Thank a lot.
Moreover, why the generated superpixel files are all black in dataset/scannet-sample/raw/selections/superpixel
? Thank again.
Hey! Sorry for the confusion. Just saw that I have an index argument.
To enable it, add index
as an option in program options in cli/main.cpp
desc.add_options()
...
("index", "save label indexes")
...
Enable index outputs with this code in cli/main.cpp
if (parameters.find("index") != parameters.end()) {
boost::filesystem::path extension = inputPath.filename().extension();
int position = inputPath.filename().string().find(extension.string());
std::string store = outputPath.string();
cv::Mat labelImage = Draw::indexImage(seeds.getLabels(), image);
cv::imwrite(store, labelImage);
if (verbose == true) {
std::cout << "Image " << inputPath.string() << " with indexed labels saved to " << store << " ..." << std::endl;
}
}
The generated superpixels look black because they are 16 bit indexed images, e.g. having values between 0-39 for 40 superpixels, therefore appearing black.
Let me know if it helps.
Thanks for your reply. It dose help. But I still have some problems for generating superpixel files as follows:
- In the origin
seeds-revised
, one of the options--csv, --contour, --labels or --mean
is needed for generating different superpixel file. However, in your code, instead of using these options, you use the--output
option to generate corresponding superpixel file for the input image. - In the origin
seeds-revised
, the--input
option denotes the folder to process. But in your implementation, it is the input image. Also, for the--output
option, yours is the output superpixel file while in original implementation, it represents the output directory. - What I concern most is that I cannot directly generate the same
black superpixel file
as yours. If I use one of these options--contour, --labels, --mean
, I getcolored superpixel files
rather thanblack 16 bit indexed images
.
Could you please tell me how can I handle these problems? I really appreciate your kind help.
It seems like my main.cpp
is quite different than the one on the master branch from seeds. Here's my version. Hopefully this helps.
It seems like my
main.cpp
is quite different than the one on the master branch from seeds. Here's my version. Hopefully this helps.
Thank you for offering the main.cpp
file. In this file, you define the --index
option which is implemented by the function Draw::indexImage(seeds.getLabels(), image)
in lib\Tools.cpp
. Could you also please offer the implementation of this function since I cannot generate the black superpixel files as yours without this --index
option. I am really appreciate!
Hey, here's my lib/Tools.cpp
file