Re: [Vxl-users] Access an image in blocks From: Ian Scott - 2006-11-03 14:39 ```Alois Komenda wrote: > Hello > > I've got some questions: > > 1) I have to calculate a value for each pixel of an picture using the values of its environment (at least a 3x3-environment, more likely 5x5). Is there a way to access the required pixels in a block mode to speed up the calculation? you can pre-calculate the offsets to a regular neighbourhood of pixels. In vil_image_view im1 ........... .....ABC... .....DEF... .....GHI... ........... where the pixel at A is at memory address ptr_a, then the memory addresses of positions of the other labelled pixels are ptr_b = ptr_a + ( im1.istep()); ptr_c = ptr_a + (2*im1.istep()); ptr_d = ptr_a + ( im1.jstep()); ptr_e = ptr_a + ( im1.istep() + im1.jstep()); ptr_f = ptr_a + (2*im1.istep() + im1.jstep()); ptr_g = ptr_a + ( 2*im1.jstep()); ptr_h = ptr_a + ( im1.istep() + 2*im1.jstep()); ptr_i = ptr_a + (2*im1.istep() + 2*im1.jstep()); The terms in the brackets can be precalculated for any given image (or indeed for any image with identical memory layout.) > > 2) Is there a function to build a quad-tree of an image available? A simple search at http://www.isbe.man.ac.uk/search_vxl.html fails to find any. > > 3) Are there methods for classification like minimum distance in vxl? You may have some specific meaning of classification in mind other than "statistical classification", since I am not aware of any standard technique called "minimum distance". However, you can find a range of statistical classifiers in the contrib/mul/clsfy library, described in http://paine.wiau.man.ac.uk/pub/doc_vxl/contrib/mul/clsfy/html/hierarchy.html Ian. ```

 Re: [Vxl-users] Access an image in blocks From: Ian Scott - 2006-11-03 14:39 ```Alois Komenda wrote: > Hello > > I've got some questions: > > 1) I have to calculate a value for each pixel of an picture using the values of its environment (at least a 3x3-environment, more likely 5x5). Is there a way to access the required pixels in a block mode to speed up the calculation? you can pre-calculate the offsets to a regular neighbourhood of pixels. In vil_image_view im1 ........... .....ABC... .....DEF... .....GHI... ........... where the pixel at A is at memory address ptr_a, then the memory addresses of positions of the other labelled pixels are ptr_b = ptr_a + ( im1.istep()); ptr_c = ptr_a + (2*im1.istep()); ptr_d = ptr_a + ( im1.jstep()); ptr_e = ptr_a + ( im1.istep() + im1.jstep()); ptr_f = ptr_a + (2*im1.istep() + im1.jstep()); ptr_g = ptr_a + ( 2*im1.jstep()); ptr_h = ptr_a + ( im1.istep() + 2*im1.jstep()); ptr_i = ptr_a + (2*im1.istep() + 2*im1.jstep()); The terms in the brackets can be precalculated for any given image (or indeed for any image with identical memory layout.) > > 2) Is there a function to build a quad-tree of an image available? A simple search at http://www.isbe.man.ac.uk/search_vxl.html fails to find any. > > 3) Are there methods for classification like minimum distance in vxl? You may have some specific meaning of classification in mind other than "statistical classification", since I am not aware of any standard technique called "minimum distance". However, you can find a range of statistical classifiers in the contrib/mul/clsfy library, described in http://paine.wiau.man.ac.uk/pub/doc_vxl/contrib/mul/clsfy/html/hierarchy.html Ian. ```
 Re: [Vxl-users] Access an image in blocks From: Alois Komenda - 2006-11-06 08:56 ```Hi Maybe my question 1) can be misunderstood easily. In generally I want to know how to access an amount of pixels of an image in the fastest way. Is vil_image_view img(i, j) designed to use it in a loop to get the values of a big amount of pixels? Or is there any way to read a line/block/... and put the values in an array? So, maybe this says it best: How to read out more than one pixel with only one library call? Best regards Alois -------- Original-Nachricht -------- Datum: Fri, 03 Nov 2006 14:39:33 +0000 Von: Ian Scott An: Alois Komenda Betreff: Re: [Vxl-users] Access an image in blocks > Alois Komenda wrote: > > Hello > > > > I've got some questions: > > > > 1) I have to calculate a value for each pixel of an picture using the > values of its environment (at least a 3x3-environment, more likely 5x5). Is > there a way to access the required pixels in a block mode to speed up the > calculation? > > > you can pre-calculate the offsets to a regular neighbourhood of pixels. > In vil_image_view im1 > ........... > .....ABC... > .....DEF... > .....GHI... > ........... > > where the pixel at A is at memory address ptr_a, > then the memory addresses of positions of the other labelled pixels are > ptr_b = ptr_a + ( im1.istep()); > ptr_c = ptr_a + (2*im1.istep()); > ptr_d = ptr_a + ( im1.jstep()); > ptr_e = ptr_a + ( im1.istep() + im1.jstep()); > ptr_f = ptr_a + (2*im1.istep() + im1.jstep()); > ptr_g = ptr_a + ( 2*im1.jstep()); > ptr_h = ptr_a + ( im1.istep() + 2*im1.jstep()); > ptr_i = ptr_a + (2*im1.istep() + 2*im1.jstep()); > > The terms in the brackets can be precalculated for any given image (or > indeed for any image with identical memory layout.) > > > > > > 2) Is there a function to build a quad-tree of an image available? > > A simple search at http://www.isbe.man.ac.uk/search_vxl.html fails to > find any. > > > > > 3) Are there methods for classification like minimum distance in vxl? > > You may have some specific meaning of classification in mind other than > "statistical classification", since I am not aware of any standard > technique called "minimum distance". > > However, you can find a range of statistical classifiers in the > contrib/mul/clsfy library, described in > http://paine.wiau.man.ac.uk/pub/doc_vxl/contrib/mul/clsfy/html/hierarchy.html > > Ian. -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer ```
 Re: [Vxl-users] Access an image in blocks From: Ian Scott - 2006-11-06 09:13 ```Alois Komenda wrote: > Hi > > Maybe my question 1) can be misunderstood easily. > In generally I want to know how to access an amount of pixels of an image in the fastest way. Is vil_image_view img(i, j) designed to use it in a loop to get the values of a big amount of pixels? Or is there any way to read a line/block/... and put the values in an array? The answer is no. However, whilst your question makes sense in itself, it is hard to answer meaningfully. If you are used to a language like Matlab, you may be used to vectorising all your code. But generally it doesn't make sense in C++. Operator(i,j) is not slow. On an optimising compiler, it will be inlined - making it the fasted possible way to randomly-access pixel locations in your image. There is no faster way to read a arbitrary random-access list of pixel locations, than writing the loop yourself. This is the nature of C++ (and libraries such as VXL which exploit C++'s main paradigms.) To reiterate my previous email, you can work a little faster if you are accessing the image in a structured fashion, by directly using the underlying pointer arithmetic which accesses an image. But since the structure of accesses depends on your application, there is no point in writing a library function to speed up such accesses. Ian. > > So, maybe this says it best: > How to read out more than one pixel with only one library call? > > Best regards > > Alois > > -------- Original-Nachricht -------- > Datum: Fri, 03 Nov 2006 14:39:33 +0000 > Von: Ian Scott > An: Alois Komenda > Betreff: Re: [Vxl-users] Access an image in blocks > >> Alois Komenda wrote: >>> Hello >>> >>> I've got some questions: >>> >>> 1) I have to calculate a value for each pixel of an picture using the >> values of its environment (at least a 3x3-environment, more likely 5x5). Is >> there a way to access the required pixels in a block mode to speed up the >> calculation? >> >> >> you can pre-calculate the offsets to a regular neighbourhood of pixels. >> In vil_image_view im1 >> ........... >> .....ABC... >> .....DEF... >> .....GHI... >> ........... >> >> where the pixel at A is at memory address ptr_a, >> then the memory addresses of positions of the other labelled pixels are >> ptr_b = ptr_a + ( im1.istep()); >> ptr_c = ptr_a + (2*im1.istep()); >> ptr_d = ptr_a + ( im1.jstep()); >> ptr_e = ptr_a + ( im1.istep() + im1.jstep()); >> ptr_f = ptr_a + (2*im1.istep() + im1.jstep()); >> ptr_g = ptr_a + ( 2*im1.jstep()); >> ptr_h = ptr_a + ( im1.istep() + 2*im1.jstep()); >> ptr_i = ptr_a + (2*im1.istep() + 2*im1.jstep()); >> >> The terms in the brackets can be precalculated for any given image (or >> indeed for any image with identical memory layout.) >> >> >>> 2) Is there a function to build a quad-tree of an image available? >> A simple search at http://www.isbe.man.ac.uk/search_vxl.html fails to >> find any. >> >>> 3) Are there methods for classification like minimum distance in vxl? >> You may have some specific meaning of classification in mind other than >> "statistical classification", since I am not aware of any standard >> technique called "minimum distance". >> >> However, you can find a range of statistical classifiers in the >> contrib/mul/clsfy library, described in >> http://paine.wiau.man.ac.uk/pub/doc_vxl/contrib/mul/clsfy/html/hierarchy.html >> >> Ian. > ```