Re: [Vxl-users] Why the image is not changed after "image(i,j,p) = 255;" ?

 Re: [Vxl-users] Why the image is not changed after "image(i,j,p) = 255;" ? From: Ian Scott - 2006-01-18 09:43:14 ```=E4=BF=8A=E6=9D=B0=E6=9B=B9 wrote: > Dear friends, >=20 > I met a strange problem that I can not modify image by the following > code. Could you give any hint? >=20 > int load_save(char* inFilename, char* outFilename) > { > // load an image > vil_image_view image; > image =3D vil_load(inFilename); >=20 > for (unsigned p=3D0;p for (unsigned j=3D0;j for (unsigned i=3D0;i { > //vcl_cout << image(i,j) << vcl_endl; > image(i,j,p) =3D vxl_byte(0); > //vcl_cout << image(i,j,p) << "\n";=09 > } >=20 > vil_save(image, outFilename, "jpeg"); >=20 > return 0; > } image(i,j,p) is indexed in normal steps of one. i.e. image(i+1,j,p) image(i,j+1,p) and image(i,j,p+1) all reference=20 pixels adjacent to image(i,j,p) (assumming that i+1::operator(i,j,p), it defines the normal pixel=20 reference method in terms of that pointer arithmetic. T& operator()(unsigned i, unsigned j, unsigned p) { return top_left_[p*planestep_ + j*jstep_ + i*istep_]; } The reason you are not seeing much change in your image, is that you may=20 only be changing the top raster of the first plane of your image,=20 because your step size is wrong. Ian. ```

 [Vxl-users] Why the image is not changed after "image(i,j,p) = 255;" ? From: - 2006-01-18 02:41:13 ```Dear friends, I met a strange problem that I can not modify image by the following code. Could you give any hint? int load_save(char* inFilename, char* outFilename) { =09// load an image =09vil_image_view image; =09image =3D vil_load(inFilename); =09for (unsigned p=3D0;p image(ni,nj,nplanes); =09for (unsigned p=3D0;p
 Re: [Vxl-users] Why the image is not changed after "image(i,j,p) = 255;" ? From: Ian Scott - 2006-01-18 09:43:14 ```=E4=BF=8A=E6=9D=B0=E6=9B=B9 wrote: > Dear friends, >=20 > I met a strange problem that I can not modify image by the following > code. Could you give any hint? >=20 > int load_save(char* inFilename, char* outFilename) > { > // load an image > vil_image_view image; > image =3D vil_load(inFilename); >=20 > for (unsigned p=3D0;p for (unsigned j=3D0;j for (unsigned i=3D0;i { > //vcl_cout << image(i,j) << vcl_endl; > image(i,j,p) =3D vxl_byte(0); > //vcl_cout << image(i,j,p) << "\n";=09 > } >=20 > vil_save(image, outFilename, "jpeg"); >=20 > return 0; > } image(i,j,p) is indexed in normal steps of one. i.e. image(i+1,j,p) image(i,j+1,p) and image(i,j,p+1) all reference=20 pixels adjacent to image(i,j,p) (assumming that i+1::operator(i,j,p), it defines the normal pixel=20 reference method in terms of that pointer arithmetic. T& operator()(unsigned i, unsigned j, unsigned p) { return top_left_[p*planestep_ + j*jstep_ + i*istep_]; } The reason you are not seeing much change in your image, is that you may=20 only be changing the top raster of the first plane of your image,=20 because your step size is wrong. Ian. ```