コード例 #1
0
void AtrousGabor::_image_sub(IMAGE_PTR i1, IMAGE_PTR i2, IMAGE_PTR out)
{
#ifdef USE_IPP		
	IppiSize roiSize = {m_i_colsext, m_i_linesext};
	ippiSub_32f_C1R(i2, m_i_strideext, i1, m_i_strideext, out, m_i_strideext, roiSize);
#else
	int i, j;
	for(i = 0; i < m_i_linesext; i++)
		for(j = 0; j < m_i_colsext; j++)
			out[i*m_i_stridepix+j] = i1[i*m_i_stridepix+j] - i2[i*m_i_stridepix+j];
#endif
}
コード例 #2
0
IppStatus BandPass_2D(Image2D &image_in, Image2D &image_bandpassed, const int feature_radius, const int hwhm_length)
{
	//set status variable
	IppStatus status;
	Gaussian_Kernel GaussKernel(feature_radius, hwhm_length, image_in.get_width(), image_in.get_length());
	Convolution_Kernel ConvolutionKernels(feature_radius, image_in.get_width(), image_in.get_length());
	Tophat_Kernel TopHatKernel(feature_radius, image_in.get_width(), image_in.get_length());
	int number_of_pixels = image_in.get_numberofpixels();
	int step_size = image_in.get_stepsize();

	//Create and initialize intermediate images
	Image2D image_gauss_col(image_in.get_length(), image_in.get_width());
	Image2D image_gauss_rowcol(image_in.get_length(), image_in.get_width());
	Image2D image_tophat(image_in.get_length(), image_in.get_width());

	//Gaussian kernel convolution
	status = ippiFilterColumn_32f_C1R(image_in.get_image2D() + GaussKernel.get_offset(), step_size,
		image_gauss_col.get_image2D() + GaussKernel.get_offset(), step_size,
		GaussKernel.get_ROI_size(), GaussKernel.get_gaussian_kernel(),
		GaussKernel.get_kernel_length(), GaussKernel.get_anchor_point());
	status = ippiFilterRow_32f_C1R(image_gauss_col.get_image2D() + GaussKernel.get_offset(), step_size,
		image_gauss_rowcol.get_image2D() + GaussKernel.get_offset(), step_size,
		GaussKernel.get_ROI_size(), GaussKernel.get_gaussian_kernel(),
		GaussKernel.get_kernel_length(), GaussKernel.get_anchor_point());

/*
	//tophat kernel convolution/filterbox operation
	status = ippiFilterBox_32f_C1R(image_in.get_image2D() + TopHatKernel.get_offset(), step_size,
		image_tophat.get_image2D() + TopHatKernel.get_offset(), step_size,
		TopHatKernel.get_ROI_size(), TopHatKernel.get_mask_size(),
		TopHatKernel.get_anchor_point());
*/

	//change by Eli Sloutskin: take away bias of square filtering kernel
    status = ippiConvValid_32f_C1R(image_in.get_image2D(), step_size, image_in.get_ROIfull(),
            ConvolutionKernels.get_circle_kernel(), ConvolutionKernels.get_kernel_step(), ConvolutionKernels.get_kernel_size(),
            image_tophat.get_image2D() + ConvolutionKernels.get_offset(), step_size);

    ippiDivC_32f_C1IR(3*feature_radius*feature_radius, image_tophat.get_image2D(),image_tophat.get_stepsize(),image_tophat.get_ROIfull());

	//subtract the two images
	status = ippiSub_32f_C1R(image_tophat.get_image2D() + TopHatKernel.get_offset(), step_size,
		image_gauss_rowcol.get_image2D()+TopHatKernel.get_offset(), step_size,
		image_bandpassed.get_image2D() + TopHatKernel.get_offset(), step_size,
		TopHatKernel.get_ROI_size());

	//cutoff values below zero
	status = ippiThreshold_LTVal_32f_C1IR(image_bandpassed.get_image2D() + TopHatKernel.get_offset(), step_size,
		TopHatKernel.get_ROI_size(),0,0);

	return status;
}
コード例 #3
0
IppStatus FindLocalMax_2D(Image2D &image_bpass, Image2D &image_bpass_thresh, Image2D &image_subtracted,
						  const int intensity_threshold, const int dilation_radius)
{
	IppStatus status;
	Image2D image_dilated(image_bpass.get_length(), image_bpass.get_width());
	Dilation_Kernel DilationKernel(dilation_radius, image_bpass.get_width(), image_bpass.get_length());

	//Threshold darker pixels in bandpassed image (in preparation for later subtraction)
	RecenterImage(image_bpass);
	status = ippiThreshold_LTVal_32f_C1R(image_bpass.get_image2D(), image_bpass.get_stepsize(),
		image_bpass_thresh.get_image2D(), image_bpass_thresh.get_stepsize(),
		image_bpass.get_ROIfull(), intensity_threshold, intensity_threshold);

	//Dilate Bandpassed image with a circular kernel
	status = ippiSet_32f_C1R(intensity_threshold, image_dilated.get_image2D(), image_dilated.get_stepsize(),
		image_dilated.get_ROIfull());
	status = ippiDilate_32f_C1R(
		//image_bpass.get_image2D() + DilationKernel.get_offset(), image_bpass.get_stepsize(),
		image_bpass_thresh.get_image2D() + DilationKernel.get_offset(), image_bpass_thresh.get_stepsize(),
		image_dilated.get_image2D()+ DilationKernel.get_offset(), image_dilated.get_stepsize(),
		DilationKernel.get_ROI_size(), DilationKernel.get_dilation_kernel(), DilationKernel.get_mask_size(),
		DilationKernel.get_anchor_point());

	//subtract, such that resulting array is negative to zero (for later exponentation)
	status = ippiSub_32f_C1R(
		image_dilated.get_image2D(), image_dilated.get_stepsize(),
		image_bpass.get_image2D(), image_bpass.get_stepsize(),
		image_subtracted.get_image2D(), image_subtracted.get_stepsize(),
		image_bpass.get_ROIfull());

	//exponentiate subtracted array, then threshold
	status = ippiExp_32f_C1IR(image_subtracted.get_image2D(), image_subtracted.get_stepsize(),
		image_subtracted.get_ROIfull());
	status = ippiThreshold_LTValGTVal_32f_C1IR(image_subtracted.get_image2D(), image_subtracted.get_stepsize(),
		image_subtracted.get_ROIfull(), 1-epsilon, 0, 1-epsilon, 1);
	return status;
}