Ask Your Question

bighealthkick's profile - activity

2020-12-08 10:34:47 -0600 received badge  Notable Question (source)
2019-02-17 19:41:56 -0600 received badge  Popular Question (source)
2016-10-05 04:18:39 -0600 received badge  Enthusiast
2016-10-02 09:51:39 -0600 commented question Python script with opencv_createsamples doesn't create samples

what would you suggest? I know that! :) I am planning to train couple of classifiers. each for different ingredient.

2016-10-02 06:44:38 -0600 commented question Python script with opencv_createsamples doesn't create samples

ok. I am trying to detect different ingredients. if I could recognize some fruits and vegetables, then it will be awesome :D. too bad, they don't have too many features. training classifiers look for me like the best option for solving this problem.

2016-10-02 04:58:35 -0600 commented question Python script with opencv_createsamples doesn't create samples

as I said, I was basing on tutorial - my script was meant to create n infoXX.txt (n-number of positive images), then everything from n infoXX.txt would be saved in a single info.txt file and than I would run again opencv_createsamples but with -info as input and -vec as output. so idea to create info.txt file was the same but opencv_annotation app only mark regions where positive sample is, so I cannot increase number of positive samples like I do with my script. it also applies no distortion, while samples created with my script will be with distortion.

2016-10-02 03:31:35 -0600 commented question Python script with opencv_createsamples doesn't create samples

I was basing on this tutorial

2016-10-02 01:15:36 -0600 received badge  Editor (source)
2016-10-02 00:56:49 -0600 asked a question Python script with opencv_createsamples doesn't create samples

I create positive samples to get classificator through opencv_traincascade. I wrote a Python script that iterates through all the positive images and does "opencv_createsamples" command on them. Everything works fine, there's no error, it looks as the samples are really creating (in terminal, after each command, all parameters are written and 'Done' after them). I run my script with absolute path to project directory as parameter. The "opencv_createsamples" command for one of positive images looks like:

opencv_createsamples -bg /home/path_to_project/project_dir/negatives.txt -num 2 -maxxangle 0.0 -maxyangle 0.0 -maxzangle 0.3 -bgcolor 0 -bgthresh 8 -w 40 -h 40 -img /home/path_to_project/project_dir/positives/18.JPG -info /home/path_to_project/project_dir/samples/info21.txt

That command should create two .jpg files and info21.txt file in 'samples' directory, but it doesn't. If I run exactly that command above separately in terminal (in any directory), it would create files in 'samples' folder. I have no idea why it works alone and doesn't work when it is run from python script.

Edit: I run Python script with just calling opencv_createsamples command and it worked fine - it created samples. The problem is that the same command doesn't work in loop:

for fname in os.listdir(directory+POSITIVES):
    if fname.endswith(".jpg") or fname.endswith(".JPG"): 
        call("opencv_createsamples (...)", shell=True)
2016-07-01 06:07:02 -0600 commented question OpenCV Android - Cannot Resolve Corresponding JNI Function

Have you found a solution?

2016-06-27 07:25:34 -0600 received badge  Supporter (source)