1 / 13

Softwaretechnologie für Fortgeschrittene Teil Thaller Stunde II: Bildverarbeitung II

Softwaretechnologie für Fortgeschrittene Teil Thaller Stunde II: Bildverarbeitung II. Köln 29. November 2012. Lookuptable Transformationen. Intensitätsmodifikation: table8=new unsigned int[256]; for (int i=0;i<256;i++) { newpixel=i+value; if (newpixel < 0)newpixel=0;

Download Presentation

Softwaretechnologie für Fortgeschrittene Teil Thaller Stunde II: Bildverarbeitung II

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. Softwaretechnologie für FortgeschritteneTeil ThallerStunde II: Bildverarbeitung II Köln 29. November 2012

  2. Lookuptable Transformationen Intensitätsmodifikation: table8=new unsigned int[256]; for (int i=0;i<256;i++) { newpixel=i+value; if (newpixel < 0)newpixel=0; else if (newpixel>255) newpixel=255; table8[i]=newpixel; } result=TIlookup(image,(void *)table8); delete table8;

  3. Lookuptable Transformationen Wobei gilt TIlookup ==: for (int y=0;y<image.height();y++) for (int x=0;x<image.width();x++) *(result.scanLine(y) + x) = table8[*(image.scanLine(y) + x)];

  4. Lookuptable Transformationen Wobei gilt TIlookup ==: for (int y=0;y<image.height();y++) for (int x=0;x<image.width();x++) *(result.scanLine(y) + x) = table8[*(image.scanLine(y) + x)];

  5. Lookuptable Transformationen Davon abgeleitet: Winkeltransformation (Beispiel cosinus) arcfactor=M_PI/180.0; cosfactor=255.0/2.0; table8=new unsigned int[256]; for (int i=0;i<256;i++) table8[i]=(int)rint((cos((double)i*arcfactor)+1.0)*cosfactor); result=TIlookup(image,(void *)table8); delete table8;

  6. Lookuptable Transformationen Davon abgeleitet: Reduktion auf Helligkeitsausschnitt factor=(float)256.0/(high-low+1); table8=new unsigned int[256]; step=low; for (int i=0;i<256;i++) { table8[i]=(int)step; if (step<255.0) { step+=factor; if (step>255.0) step=255.0; } } result=TIlookup(image,(void *)table8); delete table8;

  7. Lookuptable Transformationen Histogramm errechnen: histo8 = new unsigned int[256]; for (int i=0; i<256; i++) histo8[i] = 0; for (int y=0;y<image.height();y++) for (int x=0;x<image.width();x++) histo8[*(image.scanLine(y) + x)]++;

  8. Lookuptable Transformationen Davon abgeleitet auch Standardkontrastausgleich 1 / 2: histo8 = (unsigned int*)TIhistogram(image); total=image.width() * image.height(); limit=(int)(total*0.05); for (low=0,i=0;low<limit;i++) low+=histo8[i]; low=i; for (high=0,i=255;high<limit;i--) high+=histo8[i]; high=i;

  9. Lookuptable Transformationen Davon abgeleitet auch Standardkontrastausgleich 2 / 2: factor=13.0/low; for (i=0,step=0.0;i<low;i++) { histo8[i]=(int)step; step+=factor; } factor=230.0/(high-low); for (step=13.0;i<high+1;i++) { histo8[i]=(int)step; step+=factor; } factor=13.0/(256-high); for (step=243.0;i<256;i++) { histo8[i]=(int)step; step+=factor; } return TIlookup(image,(void *)histo8);

  10. Lookuptable Transformationen Davon abgeleitet auch Standardkontrastausgleich 2 / 2: factor=13.0/low; for (i=0,step=0.0;i<low;i++) { histo8[i]=(int)step; step+=factor; } factor=230.0/(high-low); for (step=13.0;i<high+1;i++) { histo8[i]=(int)step; step+=factor; } factor=13.0/(256-high); for (step=243.0;i<256;i++) { histo8[i]=(int)step; step+=factor; } return TIlookup(image,(void *)histo8);

  11. Lookuptable Transformationen Verwandt damit: Table-basierter Zoom: factor = (float) zoom / (float)image.width(); xtable=new int[result.width()]; ytable=new int[result.height()]; for (int newy=0;newy<result.height();newy++) ytable[newy] = (int)(newy / factor); for (int newx=0;newx<result.width();newx++) xtable[newx] = (int)(newx / factor); for (int newy=0;newy<result.height();newy++) { newpixel=result.scanLine(newy); oldbase=image.scanLine(ytable[newy]); for (int newx=0;newx<result.width();newx++) *(newpixel++) = *(oldbase + xtable[newx]); }

  12. Lookuptable Transformationen NB: Interpolierender Zoom wird realisiert durch komplexeren Aufbau der Lookuptables.

  13. Danke für heute!

More Related