Get Pixel Channel In Exr File

Convert pixel position from display window coordinate to data window and get the specified channel.   import OpenEXR, Imath, array def get_channel(exr_file,pixel_pos,channel=’R’): # Open the input file file = OpenEXR.InputFile(exr_file) f_header=file.header() dw = f_header[‘dataWindow’] #get pixel pos relative to the datawidnow pixel_data_pos=(pixel_pos[0]-dw.min.x, pixel_pos[1]-dw.min.y) #convert 2d array to 1d array index pixel_index=pixel_data_pos[1]*(dw.max.x-dw.min.x+1)+pixel_data_pos[0]-1 # Read the specified… Continue reading Get Pixel Channel In Exr File