I know that a minmum of documentation is to do...
It is coming ASAP.
Before I have to implement the histogrammes.
The function to compute them is written, just need a little courage for wrtting the display functions.
After I will write an help file.
When you start the program, it creates a filter of 3 rows and 3 colums.
All is at 0 except the central point which indicates the sum of numbers grether than 0.
If you want to fill all the filter with 0, click CLEAR
If you want to fill all the filter with 1, click SET
The RESET button, redraws original image on the two floatting windows.
RANDOMIZE insert randomized value int the filter, except for the central point.
INVERSE compute THE NOT value for all the fileds.
SAVE saves the current file.
Action menu:
View the result window : Creates or bring to foreground the result window. In the case you closed it.
View the Original Window : Creates or bring to foreground the original window. In the case you closed it.
For example, in a 3x3, if all the fields are equal to 1, the divisor is 9.
Using a divisor may result to add a blur on the new image.
For the instant I think I don't do it well.
The version I am correcting, will compute the divisor and it will be possible to force an other value.
At last, many programs add a "Bias" field to modify the luminosity. It seems to the Alpha channel on a image.
That will be done too.
When loading an image, I want to have an histigramme to see how the colors are place on the image. Is the image too dark? That kind of graph can give many answers.
Once the filter applied, an other histogram is computed to see what changed now.
It seems complicated but I will make a big work to explain that.
Thank You for your comments.
For example try
1 0 -2
0 0 0
1 0 -2
this applies the Sobel filter
Save the image.
Load the new image and apply the following filter :
1 0 1
0 0 0
-2 0 -2
Following is a source code to write filters for Sobel, Kirsch and Robinson.
The filter given as a paramerter must be initialized with somle value.
The function initializes the others filters.
// lpFiltre_1 must already be initialized
int Convolve_GetFilters_Sobel(LPCNV_FILTERS lpFilter_1,LPCNV_FILTERS lpFilter_2)
{
lpFilter_2->Matrix[0] = lpFilter_1->Matrix[0] ;
lpFilter_2->Matrix[1] = lpFilter_1->Matrix[3] ;
lpFilter_2->Matrix[2] = lpFilter_1->Matrix[6] ;
lpFilter_2->Matrix[3] = lpFilter_1->Matrix[1] ;
lpFilter_2->Matrix[4] = lpFilter_1->Matrix[4] ;
lpFilter_2->Matrix[5] = lpFilter_1->Matrix[7] ;
lpFilter_2->Matrix[6] = lpFilter_1->Matrix[2] ;
lpFilter_2->Matrix[7] = lpFilter_1->Matrix[5] ;
lpFilter_2->Matrix[8] = lpFilter_1->Matrix[8] ;
lstrcpy(lpFilter_1->szName,"# Sobel Horz #") ;
lstrcpy(lpFilter_2->szName,"# Sobel Vert #") ;
return (TRUE) ;
}
// lpFilter_W must already be initialized
int Convolve_GetFilters_Robinson(LPCNV_FILTERS lpFilter_W,LPCNV_FILTERS lpFilter_NO,LPCNV_FILTERS lpFilter_N,LPCNV_FILTERS lpFilter_NE,LPCNV_FILTERS lpFilter_E,LPCNV_FILTERS lpFilter_SE,LPCNV_FILTERS lpFilter_S,LPCNV_FILTERS lpFilter_SO)
{
lstrcpy(lpFilter_W->szName, "# Robinson West #") ;
lstrcpy(lpFilter_NO->szName,"# Robinson North West #") ;
lstrcpy(lpFilter_N->szName, "# Robinson North #") ;
lstrcpy(lpFilter_NE->szName,"# Robinson North East #") ;
lstrcpy(lpFilter_E->szName, "# Robinson East #") ;
lstrcpy(lpFilter_SE->szName,"# Robinson South East #") ;
lstrcpy(lpFilter_S->szName, "# Robinson South #") ;
lstrcpy(lpFilter_SO->szName,"# Robinson South West #") ;
lpFilter_NO->Matrix[0] = lpFilter_W->Matrix[3] ;
lpFilter_NO->Matrix[1] = lpFilter_W->Matrix[0] ;
lpFilter_NO->Matrix[2] = lpFilter_W->Matrix[1] ;
lpFilter_NO->Matrix[3] = lpFilter_W->Matrix[6] ;
lpFilter_NO->Matrix[4] = lpFilter_W->Matrix[4] ;
lpFilter_NO->Matrix[5] = lpFilter_W->Matrix[2] ;
lpFilter_NO->Matrix[6] = lpFilter_W->Matrix[7] ;
lpFilter_NO->Matrix[7] = lpFilter_W->Matrix[8] ;
lpFilter_NO->Matrix[8] = lpFilter_W->Matrix[5] ;
lpFilter_N->Matrix[0] = lpFilter_NO->Matrix[3] ;
lpFilter_N->Matrix[1] = lpFilter_NO->Matrix[0] ;
lpFilter_N->Matrix[2] = lpFilter_NO->Matrix[1] ;
lpFilter_N->Matrix[3] = lpFilter_NO->Matrix[6] ;
lpFilter_N->Matrix[4] = lpFilter_NO->Matrix[4] ;
lpFilter_N->Matrix[5] = lpFilter_NO->Matrix[2] ;
lpFilter_N->Matrix[6] = lpFilter_NO->Matrix[7] ;
lpFilter_N->Matrix[7] = lpFilter_NO->Matrix[8] ;
lpFilter_N->Matrix[8] = lpFilter_NO->Matrix[5] ;
lpFilter_NE->Matrix[0] = lpFilter_N->Matrix[3] ;
lpFilter_NE->Matrix[1] = lpFilter_N->Matrix[0] ;
lpFilter_NE->Matrix[2] = lpFilter_N->Matrix[1] ;
lpFilter_NE->Matrix[3] = lpFilter_N->Matrix[6] ;
lpFilter_NE->Matrix[4] = lpFilter_N->Matrix[4] ;
lpFilter_NE->Matrix[5] = lpFilter_N->Matrix[2] ;
lpFilter_NE->Matrix[6] = lpFilter_N->Matrix[7] ;
lpFilter_NE->Matrix[7] = lpFilter_N->Matrix[8] ;
lpFilter_NE->Matrix[8] = lpFilter_N->Matrix[5] ;
lpFilter_E->Matrix[0] = lpFilter_NE->Matrix[3] ;
lpFilter_E->Matrix[1] = lpFilter_NE->Matrix[0] ;
lpFilter_E->Matrix[2] = lpFilter_NE->Matrix[1] ;
lpFilter_E->Matrix[3] = lpFilter_NE->Matrix[6] ;
lpFilter_E->Matrix[4] = lpFilter_NE->Matrix[4] ;
lpFilter_E->Matrix[5] = lpFilter_NE->Matrix[2] ;
lpFilter_E->Matrix[6] = lpFilter_NE->Matrix[7] ;
lpFilter_E->Matrix[7] = lpFilter_NE->Matrix[8] ;
lpFilter_E->Matrix[8] = lpFilter_NE->Matrix[5] ;
lpFilter_SE->Matrix[0] = lpFilter_E->Matrix[3] ;
lpFilter_SE->Matrix[1] = lpFilter_E->Matrix[0] ;
lpFilter_SE->Matrix[2] = lpFilter_E->Matrix[1] ;
lpFilter_SE->Matrix[3] = lpFilter_E->Matrix[6] ;
lpFilter_SE->Matrix[4] = lpFilter_E->Matrix[4] ;
lpFilter_SE->Matrix[5] = lpFilter_E->Matrix[2] ;
lpFilter_SE->Matrix[6] = lpFilter_E->Matrix[7] ;
lpFilter_SE->Matrix[7] = lpFilter_E->Matrix[8] ;
lpFilter_SE->Matrix[8] = lpFilter_E->Matrix[5] ;
lpFilter_S->Matrix[0] = lpFilter_SE->Matrix[3] ;
lpFilter_S->Matrix[1] = lpFilter_SE->Matrix[0] ;
lpFilter_S->Matrix[2] = lpFilter_SE->Matrix[1] ;
lpFilter_S->Matrix[3] = lpFilter_SE->Matrix[6] ;
lpFilter_S->Matrix[4] = lpFilter_SE->Matrix[4] ;
lpFilter_S->Matrix[5] = lpFilter_SE->Matrix[2] ;
lpFilter_S->Matrix[6] = lpFilter_SE->Matrix[7] ;
lpFilter_S->Matrix[7] = lpFilter_SE->Matrix[8] ;
lpFilter_S->Matrix[8] = lpFilter_SE->Matrix[5] ;
lpFilter_SO->Matrix[0] = lpFilter_S->Matrix[3] ;
lpFilter_SO->Matrix[1] = lpFilter_S->Matrix[0] ;
lpFilter_SO->Matrix[2] = lpFilter_S->Matrix[1] ;
lpFilter_SO->Matrix[3] = lpFilter_S->Matrix[6] ;
lpFilter_SO->Matrix[4] = lpFilter_S->Matrix[4] ;
lpFilter_SO->Matrix[5] = lpFilter_S->Matrix[2] ;
lpFilter_SO->Matrix[6] = lpFilter_S->Matrix[7] ;
lpFilter_SO->Matrix[7] = lpFilter_S->Matrix[8] ;
lpFilter_SO->Matrix[8] = lpFilter_S->Matrix[5] ;
return (TRUE) ;
}
// lpFilter_W must already be initialized
int Convolve_GetFilters_Kirsch(LPCNV_FILTERS lpFilter_W,LPCNV_FILTERS lpFilter_N,LPCNV_FILTERS lpFilter_E,LPCNV_FILTERS lpFilter_S)
{
lstrcpy(lpFilter_W->szName,"# Kirsch West #") ;
lstrcpy(lpFilter_N->szName,"# Kirsch North #") ;
lstrcpy(lpFilter_E->szName,"# Kirsch East #") ;
lstrcpy(lpFilter_S->szName,"# Kirsch South #") ;
lpFilter_N->Matrix[0] = lpFilter_W->Matrix[7] ;
lpFilter_N->Matrix[1] = lpFilter_W->Matrix[3] ;
lpFilter_N->Matrix[2] = lpFilter_W->Matrix[0] ;
lpFilter_N->Matrix[3] = lpFilter_W->Matrix[6] ;
lpFilter_N->Matrix[4] = lpFilter_W->Matrix[4] ;
lpFilter_N->Matrix[5] = lpFilter_W->Matrix[1] ;
lpFilter_N->Matrix[6] = lpFilter_W->Matrix[8] ;
lpFilter_N->Matrix[7] = lpFilter_W->Matrix[5] ;
lpFilter_N->Matrix[8] = lpFilter_W->Matrix[2] ;
lpFilter_E->Matrix[0] = lpFilter_N->Matrix[2] ;
lpFilter_E->Matrix[1] = lpFilter_N->Matrix[1] ;
lpFilter_E->Matrix[2] = lpFilter_N->Matrix[0] ;
lpFilter_E->Matrix[3] = lpFilter_N->Matrix[7] ;
lpFilter_E->Matrix[4] = lpFilter_N->Matrix[4] ;
lpFilter_E->Matrix[5] = lpFilter_N->Matrix[1] ;
lpFilter_E->Matrix[6] = lpFilter_N->Matrix[8] ;
lpFilter_E->Matrix[7] = lpFilter_N->Matrix[7] ;
lpFilter_E->Matrix[8] = lpFilter_N->Matrix[2] ;
lpFilter_S->Matrix[0] = lpFilter_E->Matrix[6] ;
lpFilter_S->Matrix[1] = lpFilter_E->Matrix[7] ;
lpFilter_S->Matrix[2] = lpFilter_E->Matrix[8] ;
lpFilter_S->Matrix[3] = lpFilter_E->Matrix[3] ;
lpFilter_S->Matrix[4] = lpFilter_E->Matrix[4] ;
lpFilter_S->Matrix[5] = lpFilter_E->Matrix[5] ;
lpFilter_S->Matrix[6] = lpFilter_E->Matrix[0] ;
lpFilter_S->Matrix[7] = lpFilter_E->Matrix[1] ;
lpFilter_S->Matrix[8] = lpFilter_E->Matrix[2] ;
return (TRUE) ;
}
Some help :
https://en.wikipedia.org/wiki/Sobel_operatorhttps://en.wikipedia.org/wiki/Laplace_operatorhttps://en.wikipedia.org/wiki/Prewitt_operatorhttps://en.wikipedia.org/wiki/Roberts_crosshttps://en.wikipedia.org/wiki/Robinson_compass_maskYou can search Nagoa too.
An example of what you can do
and its histogram
That's all for now.
I'm going to take a nap! I am too old...