[Scilab-users] need help with image post processing

classic Classic list List threaded Threaded
5 messages Options
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] need help with image post processing

Dear Scilab community,

Thanks to Antoine's functions I am able to read tif-files as M x N x Channel - matrix.

Px values are:

red       =>  255, 0, 0
green    =>  0, 255, 0
black     =>  0, 0, 0
white     =>  255, 255, 255

Now:   I want to only keep the green pixel values.
This can be done due to:  G = img(:,:,2);

However, this plane does also include the white pixels, since white has a pixel value of 255 in the green plane.
This is Ok, as long as the white pixels are surrounded by the green area.

However there are also white pixels in the red and black area.
These white pixels should be set to 0.

I started to work with differential images , but somehow I can not get around the problem.

Please find below an example of my output.

upper line:    RGB; R-plane; G-plane ; B-plane

As you can see, the G-plane contains white pixel (2 dots), which are within the red-area
The desired output would be to have the G-plane without the 2 dots.

Any Idea?

Best Regards,
Philipp



grafik.png

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: need help with image post processing

Hello,

Maybe this is not relevant, but if the green region is garanteed to be always simply connected, you just have to fill holes in your absdiff(G,B) image (imfill function in IPCV).

S.


Le 15/07/2020 à 17:58, P M a écrit :
Dear Scilab community,

Thanks to Antoine's functions I am able to read tif-files as M x N x Channel - matrix.

Px values are:

red       =>  255, 0, 0
green    =>  0, 255, 0
black     =>  0, 0, 0
white     =>  255, 255, 255

Now:   I want to only keep the green pixel values.
This can be done due to:  G = img(:,:,2);

However, this plane does also include the white pixels, since white has a pixel value of 255 in the green plane.
This is Ok, as long as the white pixels are surrounded by the green area.

However there are also white pixels in the red and black area.
These white pixels should be set to 0.

I started to work with differential images , but somehow I can not get around the problem.

Please find below an example of my output.

upper line:    RGB; R-plane; G-plane ; B-plane

As you can see, the G-plane contains white pixel (2 dots), which are within the red-area
The desired output would be to have the G-plane without the 2 dots.

Any Idea?

Best Regards,
Philipp



grafik.png

_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: need help with image post processing

Stéphane,

Thanks for the hint.

This is nice for dots being completely surrounded by the green area.

In general there might be cases, where the dots are part of the red and part of the green area.

The result would than be like this:

grafik.png

Appreciate your input.
Philipp

Am Mi., 15. Juli 2020 um 18:21 Uhr schrieb Stéphane Mottelet <[hidden email]>:

Hello,

Maybe this is not relevant, but if the green region is garanteed to be always simply connected, you just have to fill holes in your absdiff(G,B) image (imfill function in IPCV).

S.


Le 15/07/2020 à 17:58, P M a écrit :
Dear Scilab community,

Thanks to Antoine's functions I am able to read tif-files as M x N x Channel - matrix.

Px values are:

red       =>  255, 0, 0
green    =>  0, 255, 0
black     =>  0, 0, 0
white     =>  255, 255, 255

Now:   I want to only keep the green pixel values.
This can be done due to:  G = img(:,:,2);

However, this plane does also include the white pixels, since white has a pixel value of 255 in the green plane.
This is Ok, as long as the white pixels are surrounded by the green area.

However there are also white pixels in the red and black area.
These white pixels should be set to 0.

I started to work with differential images , but somehow I can not get around the problem.

Please find below an example of my output.

upper line:    RGB; R-plane; G-plane ; B-plane

As you can see, the G-plane contains white pixel (2 dots), which are within the red-area
The desired output would be to have the G-plane without the 2 dots.

Any Idea?

Best Regards,
Philipp



grafik.png

_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: need help with image post processing

Another possibility: compute the connected components of the green plane bitmap image and keep only the largest one. You can use imlabel then imblobprop (in IPCV):

im=im2bw(imread("G.jpg"),0.5); // I took a screenshot of your G plane image

clf
subplot(1,2,1)
imshow(im)

[im_labeled,n] = imlabel(im);
[a,bb,c] = imblobprop(im_labeled);
[as,k]=gsort(a);
for i=2:n
    im(im_labeled==k(i))=0;
end

subplot(1,2,2)
imshow(im)

S.

Le 15/07/2020 à 20:39, P M a écrit :
Stéphane,

Thanks for the hint.

This is nice for dots being completely surrounded by the green area.

In general there might be cases, where the dots are part of the red and part of the green area.

The result would than be like this:

grafik.png

Appreciate your input.
Philipp

Am Mi., 15. Juli 2020 um 18:21 Uhr schrieb Stéphane Mottelet <[hidden email]>:

Hello,

Maybe this is not relevant, but if the green region is garanteed to be always simply connected, you just have to fill holes in your absdiff(G,B) image (imfill function in IPCV).

S.


Le 15/07/2020 à 17:58, P M a écrit :
Dear Scilab community,

Thanks to Antoine's functions I am able to read tif-files as M x N x Channel - matrix.

Px values are:

red       =>  255, 0, 0
green    =>  0, 255, 0
black     =>  0, 0, 0
white     =>  255, 255, 255

Now:   I want to only keep the green pixel values.
This can be done due to:  G = img(:,:,2);

However, this plane does also include the white pixels, since white has a pixel value of 255 in the green plane.
This is Ok, as long as the white pixels are surrounded by the green area.

However there are also white pixels in the red and black area.
These white pixels should be set to 0.

I started to work with differential images , but somehow I can not get around the problem.

Please find below an example of my output.

upper line:    RGB; R-plane; G-plane ; B-plane

As you can see, the G-plane contains white pixel (2 dots), which are within the red-area
The desired output would be to have the G-plane without the 2 dots.

Any Idea?

Best Regards,
Philipp



grafik.png

_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: need help with image post processing

Stéphane,

thank you, I can work with that.

Regards,
Philipp




Am Mi., 15. Juli 2020 um 22:14 Uhr schrieb Stéphane Mottelet <[hidden email]>:

Another possibility: compute the connected components of the green plane bitmap image and keep only the largest one. You can use imlabel then imblobprop (in IPCV):

im=im2bw(imread("G.jpg"),0.5); // I took a screenshot of your G plane image

clf
subplot(1,2,1)
imshow(im)

[im_labeled,n] = imlabel(im);
[a,bb,c] = imblobprop(im_labeled);
[as,k]=gsort(a);
for i=2:n
    im(im_labeled==k(i))=0;
end

subplot(1,2,2)
imshow(im)

S.

Le 15/07/2020 à 20:39, P M a écrit :
Stéphane,

Thanks for the hint.

This is nice for dots being completely surrounded by the green area.

In general there might be cases, where the dots are part of the red and part of the green area.

The result would than be like this:

grafik.png

Appreciate your input.
Philipp

Am Mi., 15. Juli 2020 um 18:21 Uhr schrieb Stéphane Mottelet <[hidden email]>:

Hello,

Maybe this is not relevant, but if the green region is garanteed to be always simply connected, you just have to fill holes in your absdiff(G,B) image (imfill function in IPCV).

S.


Le 15/07/2020 à 17:58, P M a écrit :
Dear Scilab community,

Thanks to Antoine's functions I am able to read tif-files as M x N x Channel - matrix.

Px values are:

red       =>  255, 0, 0
green    =>  0, 255, 0
black     =>  0, 0, 0
white     =>  255, 255, 255

Now:   I want to only keep the green pixel values.
This can be done due to:  G = img(:,:,2);

However, this plane does also include the white pixels, since white has a pixel value of 255 in the green plane.
This is Ok, as long as the white pixels are surrounded by the green area.

However there are also white pixels in the red and black area.
These white pixels should be set to 0.

I started to work with differential images , but somehow I can not get around the problem.

Please find below an example of my output.

upper line:    RGB; R-plane; G-plane ; B-plane

As you can see, the G-plane contains white pixel (2 dots), which are within the red-area
The desired output would be to have the G-plane without the 2 dots.

Any Idea?

Best Regards,
Philipp



grafik.png

_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users