Академический Документы
Профессиональный Документы
Культура Документы
Adam Steinberger
steinz08@gmail.com http://www.amsteinberger.com/ Summer 2011
The following files are saved on UVEA in the visionmatlab home directory in /students/home/visionmatlab/workspace/. Runnable files include: Bayer2JPGtest4.m, cropImages.m, demosaicTest.m, demosaicTest2.m, findErrEdges.m, findErrEdgeSmooth.m, findErrNew.m, findError.m, getBadImgStats.m, getDemoStats.m, getImageStats.m, getImageStatsEdge.m, getRAW8bit.m, getRawDemoStats.m, graphImageStats.m, graphImageStats2.m, graphImageStat3.m.
Bayer2JPGtest4.m (108 lines)
Dependencies: ForensicImage.m, imgEdges.m, camCrop2.jpg Read image file /students/home/visonmatlab/workspace/camCrop2.jpg and create Bayer patterns of the given JPEG. Then for each Bayer pattern image, get the color channel intensity gradients and demosaicing patterns for smooth and edge areas and convert image back to JPEG accordingly. Outputs difference between original JPEG and new JPEG images.
color_channel, where win = window_size. The window is of size win by win square pixels, where win is an odd integer greater than 1. Currently, this function grabs all pixels in this window; getAltColorBins(): separates image color channels by (R+G+B)/3, (R-B)/2, (2G-RB)/4. imgStatsACB(): returns an imgStats objects for image statistics based on the image's alternate color bins. Uses imgStats.m to return image statistics. AvgPixel(): Get average pixel of image. imgStats(): returns three imgStats objects for image statistics using 3 by 3, 5 by 5, and 7 by 7 square pixel windows. Uses imgStats.m to return image statistics. Also uses medfilt2new.m to get the median of pixel neighbors. imgStatsEdge(th1,th2,cam,pic): returns three imgStats objects for image edge pixel statistics using 3 by 3, 5 by 5, and 7 by 7 square pixel windows, where th1 = threshold for edge detection, th2 = threshold for median filter, cam = camera number (when used by getImageStatsEdge.m), and pic = photo number (when used by getImageStatsEdge.m). Uses imgStats.m to return image statistics. Also uses medfilt2edge.m to get the median of pixel neighbors. ImgStatsSmooth(th1): returns three imgStats objects for image smooth pixel statistics using 3 by 3, 5 by 5, and 7 by 7 square pixel windows, where th1 = threshold for edge detection. Uses imgStats.m to return image statistics. Also uses medfilt2new.m to get the median of pixel neighbors. getBayer(): turns an image into four different Bayer Color Filter Array patterns, and each pattern is saved as a new image. getImgEdge(bNum): return imgEdge of channel intensity gradients and demosaicing patterns for smooth and edge areas for the Bayer pattern image where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. getColorPats(bNum): return four images in which each pixel is the mean of an appropriate neighborhood to get bayer color patterns, where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. demoBayerR(x,imgVB,imgHB,imgD1,imgD2): Demosaic bayer red pattern images (used with block process), where imgVB, imgHB, imgD1, and imgD2 are the images returned from getColorPats(). demoBayerG1(x,imgVB,imgHB,imgD1,imgD2): Demosaic bayer green1 pattern images (used with block process), where imgVB, imgHB, imgD1, and imgD2 are the images returned from getColorPats(). demoBayerG2(x,imgVB,imgHB,imgD1,imgD2): Demosaic bayer green 2 pattern images (used with block process), where imgVB, imgHB, imgD1, and imgD2 are the images returned from getColorPats(). demoBayerB(x,imgVB,imgHB,imgD1,imgD2): Demosaic bayer blue pattern images (used with block process), where imgVB, imgHB, imgD1, and imgD2 are the images returned from getColorPats(). getImgChr(bNum,iEdge,iTh): Get chirality images for bayer pattern image, where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. Also, iEdge is imgEdges for image with edge types, and iTh 08/05/2011 3
is image with edge types. chr2jpg(bNum,img,imgChr,iCV,iCH,iCD1,iCD2): Convert edges in bayer image to JPEG, where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. Also, img = 3 color channel image, imgChr = image with edge type chiralities, iCV = imgChiral for vertical edge chiral patterns, iCH = imgChiral for horizontal edge chiral patterns, iCD1 = imgChiral for forward diagonal edge chiral patterns, and iCD2 = imgChiral for backward diagonal edge chiral patterns. getChrPats(bNum): get chiral patterns from a bayer image, where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. demoStats(th1): Demosaic image, where th1 = threshold for edge detection.
uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. getImgChr(bNum,iEdge,iTh): Get chirality images for bayer pattern image, where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. Also, iEdge is imgEdges for image with edge types, and iTh is image with edge types. getChrPats(bNum): get chiral patterns from a bayer image, where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. chr2jpg(bNum,img,imgChr,iCV,iCH,iCD1,iCD2): Convert edges in bayer image to JPEG, where bNum = 1 uses bayerR, bNum = 2 uses bayerGR, bNum = 3 uses bayerGB, and bNum = 4 uses bayerB. Also, img = 3 color channel image, imgChr = image with edge type chiralities, iCV = imgChiral for vertical edge chiral patterns, iCH = imgChiral for horizontal edge chiral patterns, iCD1 = imgChiral for forward diagonal edge chiral patterns, and iCD2 = imgChiral for backward diagonal edge chiral patterns. demosaicImg(th1): Demosaic raw image, where th1 = threshold for edge detection.
/students/home/visionmatlab/stats/07-30-demo/ by appending new data to the end of each file, so to restart this program from scratch you must delete the old data files or move them to a different folder. To restart the program from scratch, you must also edit iStatDemo.log so that it reads: filename 1 0. Because the data is read by other programs with spaces in between each data entry, any spaces in image filenames will be replaced with underscores in the data file.
Image statistics from demosaicing RAW DNG files in /students/home/semistatic/summer2011/raws/ for each camera are saved to text files. The file /students/home/visionmatlab/workspace/iStatRawDemo.log keeps track of which image file was last read, so if the program is killed or breaks it will start up where it last stopped. The data files are saved in /students/home/visionmatlab/stats/07-28-rawdemo/ by appending new data to the end of each file, so to restart this program from scratch you must delete the old data files or move them to a different folder. To restart the program from scratch, you must also edit iStatRawDemo.log so that it reads: filename 1 0. Because the data is read by other programs with spaces in between each data entry, any spaces in image filenames will be replaced with underscores in the data file.
imgChiral(imgHBneg,imgVBneg,imgD1neg,imgD2neg,imgHBpos,imgVBpos,imgD1p os,imgD2pos): Hold imgHBneg = horizontal edge negative, imgVBneg = vertical edge negative, imgD1neg = Diag1 edge negative, imgD2neg = Diag2 edge negative, imgHBpos = horizontal edge positive, imgVBpos = vertical edge positive, imgD1pos = Diag1 edge positive, and imgD2pos = Diag2 edge positive images.
08/05/2011