1 / 12

Image Filtering – Motion Blur

Image Filtering – Motion Blur. Ivan Dimitrov 508/2012. Filtering in g eneral. Widespread Suitable for Dataflow Easily upgradable. 2/11. Applying the filter. To apply the filter on the current pixel, you need to use his neighbor pixels. 2/10. 3/11. Sequential implementation.

marlenen
Download Presentation

Image Filtering – Motion Blur

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Image Filtering – Motion Blur Ivan Dimitrov 508/2012

  2. Filtering in general • Widespread • Suitable for Dataflow • Easily upgradable 2/11

  3. Applying the filter • To apply the filter on the current pixel, you need to use his neighbor pixels 2/10 3/11

  4. Sequential implementation for(int x = 0; x < w; x++) for(int y = 0; y < h; y++) { double red = 0.0, green = 0.0, blue = 0.0; //multiply every value of the filter with corresponding image pixel for(intfilterX = 0; filterX < filterWidth; filterX++) //filtering for(intfilterY = 0; filterY < filterHeight; filterY++) { intimageX = (x - filterWidth / 2 + filterX + w) % w; intimageY = (y - filterHeight / 2 + filterY + h) % h; red += image[imageX][imageY].r * filter[filterX][filterY]; // red channel green += image[imageX][imageY].g * filter[filterX][filterY]; // green channel blue += image[imageX][imageY].b * filter[filterX][filterY]; //blue channel } result[x][y].r = min(max(int(factor * red + bias), 0), 255); //result image result[x][y].g = min(max(int(factor * green + bias), 0), 255); result[x][y].b = min(max(int(factor * blue + bias), 0), 255); } 4/11

  5. Maxeler implementation (1) • We need to use more than one element at a time because of how filtering works. • So we need to use Maxeler’s built-in function for getting previous elements of the array: DFEVarstream.offset(DFEVarsrc, int offset) ; 5/11

  6. Maxelerimplementation (2) • Due to the edge cases, we need to use the built-in counter function in Maxeler: DFEVarcontrol.count.simpleCounter(64); 6/11

  7. Maxeler implementation (3) class BlurKernel extends Kernel { protected BlurKernel(KernelParameters parameters) { super(parameters); DFEVar inputImg1 = io.input("array1", dfeInt(32)); DFEVar count = control.count.simpleCounter(64); DFEVar First1 = stream.offset(inputImg1, -513);); DFEVar Last1 = stream.offset(inputImg1, 513); DFEVar inputImg2 = io.input("array2", dfeInt(32)); DFEVar First2 = stream.offset(inputImg2, -513);//picsize 512x512 DFEVar Last2 = stream.offset(inputImg2, 513); DFEVar inputImg3 = io.input("array3", dfeInt(32)); DFEVar First3 = stream.offset(inputImg3, -513); DFEVar Last3 = stream.offset(inputImg3, 513); 7/11

  8. Maxeler implementation (4) inputImg1 = (count>512) ? count<(512*512-512) ? ((First1 + Last1 + inputImg1) /3):0 : 0; inputImg2 = (count>512) ? count<(512*512-512) ? (First2 + Last2 + inputImg2) /3 :0 :0; inputImg3 = (count>512) ? count<(512*512-512) ? (First3 + Last3 + inputImg3) /3 :0:0; io.output("outImage1", inputImg1, inputImg1.getType()); io.output("outImage2", inputImg2, inputImg2.getType()); io.output("outImage3", inputImg3, inputImg3.getType()); } } 8/11

  9. Output 9/11

  10. Application • Image filtering is broadly used in web applications, social networks, chat applications… • AWS will soon rent servers with Maxeler cards • Social networks and other web applications can use Maxeler servers to process their images and save a lot of energy and time 10/11

  11. References [1] Phillips, D. , Image Processing in C, R & D Publications ,1994 [2]Milutinovic, V., editor, "Computer Architecture,“ (Chapter 9, DataFlow Computation, Dennis, J.,), North Holland, 1988. [3] Milutinovic, V., Salom, J., Trifunovic, N., Giorgi, R., "Guide to DataFlowSuperComputing," Springer, 2015. [4]Hurson, A., Milutinovic, V., editors, "DataFlowProcessing,“ Elsevier, 2015. 11/11

  12. Q&A

More Related