Ask Your Question

Problem using xphoto::LearningBasedWB

asked 2018-01-02 13:12:21 -0500

David_Lavy gravatar image


I'm trying to run the tutorial provided here. The training model works just fine. However, when I do the testing I always get a segmentation fault. And this is due to using the learning based model.

I went and created a simple test using the .yml file created from the training test here. Uploaded any picture and I get the same segmentation error. Debugging the code it seems the error is in this line:

wb->balanceWhite(img, img_out);

But I have no idea why this error shows up. Any help is appreciated.


edit retag flag offensive close merge delete


and your error is ?

berak gravatar imageberak ( 2018-01-02 13:28:38 -0500 )edit

The same "Segmentation fault (core dumped)"

David_Lavy gravatar imageDavid_Lavy ( 2018-01-02 13:36:57 -0500 )edit

Something that I'm realizing is that I think the WhiteBalance pointer is not using the yml I'm referencing. If I switch the line from:

wb = xphoto::createLearningBasedWB("./color_balance_model.yml");


wb = xphoto::createLearningBasedWB();

The latter is using a default model, but not the one I trained. And it works just fine. I can't find a way to check that my model is using the yml file. If I use any string as input the code doesn't show any error. And I think that is where the problem is, because it's not using the input yml file.

David_Lavy gravatar imageDavid_Lavy ( 2018-01-02 13:49:11 -0500 )edit

can you put your yml file somewhere, so folks can test ?

berak gravatar imageberak ( 2018-01-03 06:20:34 -0500 )edit
David_Lavy gravatar imageDavid_Lavy ( 2018-01-03 09:03:08 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-01-04 05:00:00 -0500

berak gravatar image

short answer: erroneously wrote double values, where integers are expected. edit your yml, so it looks like:

num_trees: 30
num_tree_nodes: 64

(remove the dots behind 1st two numbers)

longer answer:

the problem is in the python FileStorage implementation:

>>> fs = cv2.FileStorage("my.yml", 1)
>>> a = 3
>>> type(a)
<class 'int'>
>>> fs.write("a",a)
>>> fs.release()

a: 3.
edit flag offensive delete link more



Thank you! That solved the problem.

David_Lavy gravatar imageDavid_Lavy ( 2018-01-05 09:22:18 -0500 )edit

Question Tools

1 follower


Asked: 2018-01-02 13:12:21 -0500

Seen: 223 times

Last updated: Jan 04 '18