Ask Your Question
0

Problem using xphoto::LearningBasedWB

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

David_Lavy gravatar image

Hi,

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.

Thanks!

edit retag flag offensive close merge delete

Comments

and your error is ?

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

The same "Segmentation fault (core dumped)"

David_Lavy gravatar imageDavid_Lavy ( 2018-01-02 13:36:57 -0600 )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");

To:

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 -0600 )edit

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

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

1 answer

Sort by ยป oldest newest most voted
0

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

berak gravatar image

short answer:

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

%YAML:1.0
---
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()

%YAML:1.0
---
a: 3.
edit flag offensive delete link more

Comments

1

Thank you! That solved the problem.

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

Question Tools

1 follower

Stats

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

Seen: 367 times

Last updated: Jan 04 '18