Fixing mask circle
This commit is contained in:
parent
3a613c3903
commit
25a5a92463
14
lib/mask.cpp
14
lib/mask.cpp
|
@ -1,5 +1,6 @@
|
||||||
#include "mask.h"
|
#include "mask.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
namespace Mask
|
namespace Mask
|
||||||
{
|
{
|
||||||
|
@ -21,4 +22,17 @@ namespace Mask
|
||||||
return newMask;
|
return newMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printMask( mask * mask)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < mask->size; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < mask->size; ++j)
|
||||||
|
{
|
||||||
|
printf("%d\t", mask->mask[mask->size * i + j]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace Mask
|
||||||
};
|
};
|
||||||
|
|
||||||
mask * createCircleMask(int size, bool gradient = false);
|
mask * createCircleMask(int size, bool gradient = false);
|
||||||
|
void printMask(mask *mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ifndef _MASK_H_ */
|
#endif /* ifndef _MASK_H_ */
|
||||||
|
|
|
@ -30,7 +30,8 @@ void AigoQt::updateImage( void )
|
||||||
Image::threshold(s, blackImageThreshold->value(), whiteImageThreshold->value());
|
Image::threshold(s, blackImageThreshold->value(), whiteImageThreshold->value());
|
||||||
SDL_BlitSurface(s, NULL, copy, NULL);
|
SDL_BlitSurface(s, NULL, copy, NULL);
|
||||||
|
|
||||||
Mask::mask *mask = Mask::createCircleMask(4);
|
Mask::mask *mask = Mask::createCircleMask(10);
|
||||||
|
Mask::printMask(mask);
|
||||||
|
|
||||||
if (checkErosion->isChecked()) Image::erosion(s, copy, mask);
|
if (checkErosion->isChecked()) Image::erosion(s, copy, mask);
|
||||||
if (checkDilation->isChecked()) Image::dilation(s, copy, mask);
|
if (checkDilation->isChecked()) Image::dilation(s, copy, mask);
|
||||||
|
|
Reference in New Issue