how to use Mat img on all function without any calling function
ı want to use Mat img=imread("Nature.jpg"); to all func. such volatile int temp; is there any way for this?
Hi,I think your problem can be solved by defining a global variable.
something like this:
void main void()
{
Mat img=imread("Nature.jpg");
for(;;) //for loop #1
{
//use img here
}
for(;;) //for loop #2
{
//use img here
}
and so on...
return 0;
}
Asked: 2015-10-10 05:12:53 -0600
Seen: 222 times
Last updated: Oct 10 '15
what ?????
ı meant that if you state volatile variable in C, you can use it on any loop as variable. it's not necassary to introduce one more times in loop which uses volatile variable. ı want to do like this for an image that ı loaded
please edit your question , and try to make your situation much more clear.
are you afraid, the compiler tries to optimize the imread call away ?