opencv - pass Mat to CvMat* segmentation fault -


i want pass value pointer variable, namely type mat cvmat*?

so have following , want pass variable si;;

mat s=(mat_<double>(1, 3) << 1,0,1 ); cvmat* si; *si=s; 

but gives segmentation fault, doing wrong?

use

si = &s if wanted change pointer.

or initialize si first copy s si

si = new mat_<double>(1, 3); *si = s; 

basically before initialize si, invalid pointer, , assuming want copy structure whatever address pointer refers to, invalid operation. need "own" valid memory address (which new operation creates you) in order work on object.

don't forget use delete si; @ point later on.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

keyboard - C++ GetAsyncKeyState alternative -

android - java.net.UnknownHostException(Unable to resolve host “URL”: No address associated with hostname) -