| Thread Tools | Search this thread |
|---|
westminster
| June 30, 2009 3:51 PM PDT Image sharpen function help needed | ||||
Hello, I'm trying to get an image sharpening function with parameters working (apart from the fixed FilterSharpen call). I can't figure out why the code is bombing at the ippiConvFull_32f call below. 1. Could some kind soul please look over the routine below and see if anything is amiss? 2. Does the function look like it is properly constructed to perform sharpening? The end goal is to have a sharpen function with variable strength... BOOL IppImageConvolutionSharpen_24bit(BYTE *pImageP, UINT32 uWidth, UINT32 uHeight, UINT32 uComponentsPerPixel, UINT32 uInRowStride, BYTE *pOut, UINT32 uOutRowStride, double radiusBlur /* 1.0*/ ) { IppImage32f scratch, input32f; IppStatus retval; IppImage32f krnl; int border=6; IppiSize dims; Ipp32f eval[3]; int i, j; char strDebug[80]; double f1, f2, f3; dims.height = uHeight; dims.width = uWidth; // create temporary 32f version of input data input32f = MakeIppImage_32f_C3(uWidth, uHeight); ippiConvert_8u32f_C3R(pImageP, uInRowStride, input32f.pixels, input32f.StepBytes, dims); // Make sharpen matrix // This code doesn't work for unsigned data. krnl = MakeIppImage_32f_C3(3,3); eval[0] = eval[1] = eval[2] = (-1.0/8.0); ippiSet_32f_C3R((const Ipp32f *)eval, krnl.pixels, krnl.StepBytes, krnl.dims); _ippiSetR_32f(krnl, 1, 1, 2.0); _ippiSetG_32f(krnl, 1, 1, 2.0); _ippiSetB_32f(krnl, 1, 1, 2.0); // Add border to image scratch=MakeIppImage_32f_C3(dims.width + 2 * border, dims.height + 2 * border); retval=ippiCopyReplicateBorder_32f_C3R((const Ipp32f *)input32f.pixels, input32f.StepBytes, dims, (Ipp32f *)scratch.pixels, scratch.StepBytes, scratch.dims, border, border); if(retval!=ippStsNoErr) { MessageBox(GetFocus(), "IppImageConvolutionSharpen_24bit: ippiCopyReplicateBorder_32f_C3R failed", "IppImageConvolutionSharpen_24bit", MB_OK); return 0; } // apply filter retval = ippiConvFull_32f_C3R( &scratch.pixels[scratch.StepBytes/sizeof(Ipp32f) * border + border * 3], scratch.StepBytes, dims,//scratch.dims, krnl.pixels, krnl.StepBytes, krnl.dims, input32f.pixels, input32f.StepBytes); if(retval!=ippStsNoErr) { MessageBox(GetFocus(), "IppImageConvolutionSharpen_24bit: ippiConvFull_32f_C3R failed", "IppImageConvolutionSharpen_24bit", MB_OK); return 0; } // convert results from 32f back to 8u ippiConvert_32f8u_C3R(input32f.pixels, input32f.StepBytes, pOut, uOutRowStride, dims, ippRndNear); // cleanup DeleteIppImage_32f_C3(scratch); DeleteIppImage_32f_C3(krnl); DeleteIppImage_32f_C3(input32f); return TRUE; } Thanks! | |||||
|
|||||||||||||
| 8285 users have contributed to 31229 threads and 99107 posts to date. |
|---|
| In the past 24 hours, we have 7 new thread(s) 35 new posts(s), and 47 new user(s). In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing... Escalated as Please welcome our newest member tvinni |