image processing
play

Image Processing CS 110 Why Image Processing? Medical - PowerPoint PPT Presentation

Image Processing CS 110 Why Image Processing? Medical Images 2 Why Image Processing? Manufacturing Dig;al Image Processing, Spring 2006 3 What can you


  1. Image ¡Processing ¡ CS ¡110 ¡

  2. Why ¡Image ¡Processing? ¡Medical ¡Images ¡ 2 ¡

  3. Why ¡Image ¡Processing? ¡Manufacturing ¡ Dig;al ¡Image ¡Processing, ¡Spring ¡2006 ¡ 3 ¡

  4. What ¡can ¡you ¡do ¡with ¡Image ¡Processing? ¡ ¡ Inspect, ¡Measure, ¡and ¡Count ¡using ¡Photos ¡and ¡Video ¡ hCp://www.youtube.com/watch?v=KsTtNWVhpgI ¡ ¡ Image ¡Processing ¡So<ware ¡ hCp://www.youtube.com/watch?v=1WJp9mGnWSM ¡ ¡

  5. Image Enhancement: Histogram Equalization

  6. Histogram ¡Equaliza;on ¡(Red ¡Channel) ¡ Original ¡ Equalized ¡ 8000 8000 7000 7000 6000 6000 5000 5000 4000 4000 3000 3000 2000 2000 1000 1000 0 0 0 50 100 150 200 250 0 50 100 150 200 250

  7. Histogram ¡Equaliza;on ¡(Green ¡ Channel) ¡ Original ¡ Equalized ¡ 8000 8000 7000 7000 6000 6000 5000 5000 4000 4000 3000 3000 2000 2000 1000 1000 0 0 0 50 100 150 200 250 0 50 100 150 200 250

  8. Histogram ¡Equaliza;on ¡(Blue ¡Channel) ¡ Original ¡ Equalized ¡ 9000 9000 8000 8000 7000 7000 6000 6000 5000 5000 4000 4000 3000 3000 2000 2000 1000 1000 0 0 0 50 100 150 200 250 0 50 100 150 200 250

  9. How ¡Do ¡We ¡Transform ¡the ¡Image ¡ Basic ¡idea: ¡replace ¡a ¡color ¡intensity ¡value ¡by ¡it’s ¡ percen;le ¡ A ¡few ¡sample ¡red ¡values ¡and ¡their ¡transformed ¡red ¡values: ¡ Original ¡Red ¡value ¡ PercenCle ¡in ¡ Transformed ¡Value ¡ Original ¡Image ¡ 52 ¡ 20% ¡ 51 ¡ 178 ¡ 60% ¡ 153 ¡ 228 ¡ 90% ¡ 230 ¡

  10. Histogram ¡Equaliza;on ¡Step ¡1 ¡

  11. Histogram ¡Equaliza;on ¡Step ¡2 ¡

  12. Histogram ¡Equaliza;on ¡Step ¡3 ¡

  13. Results ¡

  14. Histogram ¡Equaliza;on ¡in ¡Human ¡ Vision? ¡ Two ¡mechanisms ¡to ¡ regulate ¡the ¡dynamic ¡ range ¡of ¡the ¡eye: ¡ Pupil ¡ dilaCon , ¡chemical ¡changes ¡ in ¡the ¡re;na ¡( Perkinje ¡ effect ) ¡

  15. Spa;al ¡Filtering ¡ Input ¡Image ¡ Output ¡Image ¡ w 1 w 2 w 3 A B C w 4 w 5 w 6 D E F E' w 7 w 8 w 7 G H I Spa;al ¡ Kernel ¡Filter ¡ E' ¡= ¡w 1 A+w 2 B+w 3 C+w 4 D+w 5 E+w 6 F+w 7 G+w 8 H+w 7 I ¡

  16. // ¡Spa;al ¡Filtering ¡ ¡ void ¡draw() ¡{ ¡ // ¡Perform ¡spa;al ¡filtering ¡on ¡one ¡pixel ¡loca;on ¡ PImage ¡img; ¡ ¡ ¡// ¡Draw ¡the ¡image ¡on ¡the ¡background ¡ color ¡spa;alFilter(int ¡x, ¡int ¡y, ¡float[][] ¡matrix, ¡ ¡ PImage ¡filt; ¡ ¡ ¡image(img,0,0); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡int ¡msize, ¡PImage ¡img) ¡{ ¡ int ¡w ¡= ¡100; ¡ ¡ ¡ ¡ ¡ ¡float ¡rtotal ¡= ¡0.0; ¡ int ¡msize ¡= ¡3; ¡ ¡ ¡// ¡Get ¡current ¡filter ¡rectangle ¡loca;on ¡ ¡ ¡float ¡gtotal ¡= ¡0.0; ¡ ¡ ¡ ¡int ¡xstart ¡= ¡ ¡ ¡ ¡float ¡btotal ¡= ¡0.0; ¡ // ¡Sharpen ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡constrain(mouseX-­‑w/2,0,img.width); ¡ ¡ ¡int ¡offset ¡= ¡msize/2; ¡ float[][] ¡matrix ¡= ¡{{ ¡-­‑1., ¡-­‑1., ¡-­‑1.}, ¡ ¡ ¡int ¡ystart ¡= ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡-­‑1., ¡ ¡9., ¡-­‑1.}, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡constrain(mouseY-­‑w/2,0,img.height); ¡ ¡ ¡// ¡Loop ¡through ¡filter ¡matrix ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡-­‑1., ¡-­‑1., ¡-­‑1.}}; ¡ ¡ ¡ ¡ ¡ ¡for ¡(int ¡i=0; ¡i<msize; ¡i++) ¡{ ¡ ¡ ¡ ¡// ¡Filter ¡rectangle ¡ ¡ ¡ ¡ ¡for ¡(int ¡j=0; ¡j<msize; ¡j++) ¡{ ¡ // ¡Laplacian ¡Edge ¡DetecCon ¡ ¡ ¡loadPixels(); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ //float[][] ¡matrix ¡= ¡{{ ¡ ¡0., ¡ ¡1., ¡ ¡0. ¡}, ¡ ¡ ¡filt.loadPixels(); ¡ ¡ ¡ ¡ ¡ ¡ ¡// ¡What ¡pixel ¡are ¡we ¡tes;ng ¡ // ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡1., ¡-­‑4., ¡ ¡1. ¡}, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡int ¡xloc ¡= ¡x+i-­‑offset; ¡ // ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡0., ¡ ¡1., ¡ ¡0. ¡}}; ¡ ¡ ¡for ¡(int ¡i=0; ¡i<w; ¡i++ ¡) ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡int ¡yloc ¡= ¡y+j-­‑offset; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡for ¡(int ¡j=0; ¡j<w; ¡j++) ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡int ¡loc ¡= ¡xloc ¡+ ¡img.width*yloc; ¡ // ¡Average ¡ ¡ ¡ ¡ ¡ ¡ ¡int ¡x ¡= ¡xstart ¡+ ¡i; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ //float[][] ¡matrix ¡= ¡{{ ¡1./9., ¡1./9., ¡1./9.}, ¡ ¡ ¡ ¡ ¡ ¡ ¡int ¡y ¡= ¡ystart ¡+ ¡j; ¡ ¡ ¡ ¡ ¡ ¡ ¡// ¡Make ¡sure ¡we ¡haven't ¡walked ¡off ¡ ¡ // ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡1./9., ¡1./9., ¡1./9.}, ¡ ¡ ¡ ¡ ¡ ¡ ¡color ¡c ¡= ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡// ¡the ¡edge ¡of ¡the ¡pixel ¡array ¡ // ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡1./9., ¡1./9., ¡1./9.}}; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡spa;alFilter(x, ¡y, ¡matrix, ¡msize, ¡img); ¡ ¡ ¡ ¡ ¡ ¡ ¡loc ¡= ¡constrain(loc,0,img.pixels.length-­‑1); ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡int ¡loc ¡= ¡i+j*w; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ // ¡Gaussian ¡Blur ¡ ¡ ¡ ¡ ¡ ¡ ¡filt.pixels[loc] ¡= ¡c; ¡ ¡ ¡ ¡ ¡ ¡ ¡// ¡Calculate ¡the ¡filter ¡ //float[][] ¡matrix ¡= ¡{{ ¡ ¡1./16., ¡ ¡2./16., ¡ ¡1./16. ¡}, ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡ ¡ ¡rtotal ¡+= ¡(red(img.pixels[loc]) ¡* ¡matrix[i][j]); ¡ // ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡2./16., ¡ ¡4./16., ¡ ¡2./16. ¡}, ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡ ¡ ¡gtotal ¡+= ¡(green(img.pixels[loc]) ¡* ¡matrix[i][j]); ¡ // ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡{ ¡ ¡1./16., ¡ ¡2./16., ¡ ¡1./16. ¡}}; ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡btotal ¡+= ¡(blue(img.pixels[loc]) ¡* ¡matrix[i][j]); ¡ ¡ ¡ ¡filt.updatePixels(); ¡ ¡ ¡ ¡ ¡} ¡ void ¡setup() ¡{ ¡ ¡ ¡updatePixels(); ¡ ¡ ¡} ¡ ¡ ¡//img ¡= ¡loadImage("bmc3.jpg"); ¡ ¡ ¡ ¡ ¡ ¡// ¡Make ¡sure ¡RGB ¡is ¡within ¡range ¡ ¡ ¡img ¡= ¡loadImage("moon.jpg"); ¡ ¡ ¡// ¡Add ¡rectangle ¡around ¡convolved ¡region ¡ ¡ ¡rtotal ¡= ¡constrain(rtotal,0,255); ¡ ¡ ¡size( ¡img.width, ¡img.height ¡); ¡ ¡ ¡stroke(0); ¡ ¡ ¡gtotal ¡= ¡constrain(gtotal,0,255); ¡ ¡ ¡filt ¡= ¡createImage(w, ¡w, ¡RGB); ¡ ¡ ¡noFill(); ¡ ¡ ¡btotal ¡= ¡constrain(btotal,0,255); ¡ } ¡ ¡ ¡image(filt, ¡xstart, ¡ystart); ¡ ¡ ¡ ¡ ¡ ¡rect(xstart, ¡ystart, ¡w, ¡w); ¡ ¡ ¡// ¡return ¡resul;ng ¡color ¡ } ¡ ¡ ¡return ¡color(rtotal, ¡gtotal, ¡btotal); ¡ } ¡

  17. Sharpen ¡ Edge ¡ Gaussian ¡ Detec;on ¡ Blur ¡

  18. Image ¡Processing ¡in ¡Processing ¡ ;nt() ¡modulate ¡individual ¡color ¡components ¡ blend() ¡combine ¡the ¡pixels ¡of ¡two ¡images ¡in ¡a ¡given ¡manner ¡ filter() ¡apply ¡an ¡image ¡processing ¡algorithm ¡to ¡an ¡image ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend