I'm trying to create a bmp image file off of a display window but the
file size once created is about 3.0mb.
I've created images using the z-buffer and a 1024x1024 image was about
1.0mb but this one is also a 1024x1024 so I'm not sure what is going
on. Any help is greatly appreciated. Here's my code:
This first piece of code I used before and it works great. It creates
a 1024x1024 image at about 1.0mb.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Uses the Canny edge detection
;;algorithm to detect rings in image.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRO edgedetect,image
image->GET, image=img,size=size
;LOADCT, 0
mydevice = !D.NAME
SET_PLOT, 'Z'
ERASE
DEVICE, SET_RESOLUTION=[1024,1024]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CANNY CODE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
image=ROTATE(img, 7)
filteredImage = CANNY(image)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Display Image
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
tvscl, congrid(filteredImage, 1024, 1024)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Save image
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
image = TVRead(Filename='edgeDetect',/NODIALOG,/BMP)
image = READ_BMP('/home/users/fjosuna/CASVU_ISS/edgeDetect.bmp')
OPENW, lun, 'edgeDetect.dat', /GET_LUN
WRITEU, lun, image
FREE_LUN, lun
ERASE
SET_PLOT, mydevice
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
END
This code however gives me a 3.0mb 1024x1024 image. Any ideas why?
PRO RegionGrowEx
; Prepare the display device and load a grayscale color
; table.
DEVICE, DECOMPOSED = 0, RETAIN = 2
LOADCT, 0
; Load an image and get the image dimensions.
file = FILEPATH('wireframe.bmp', $
ROOT_DIR = ['/home/users/fjosuna/CASVU_ISS/'])
img = READ_BMP(file)
dims = SIZE(img, /DIMENSIONS)
; Create a window and display the image.
WINDOW, 0, XSIZE = dims[0], YSIZE = dims[1], $
TITLE = 'Click on Image to Select Point of ROI'
TVSCL, congrid(img,1024,1024)
; Define the original region pixels. Use the CURSOR
; function to select the region, making a 10x10 square
; at the selected x,y, coordinates.
CURSOR, xi, yi, /DEVICE
x = LINDGEN(5*5) MOD 5 + xi
y = LINDGEN(5*5) / 5 + yi
roiPixels = x + y * dims[0]
; Delete the window after selecting the point.
WDELETE, 0
; Set the topmost color table entry to white.
topClr = !D.TABLE_SIZE - 1
TVLCT, 255, 0, 0, topClr
; Scale the array, setting the maximum array value
; equal to one less than the value of topClr.
regionPts = BYTSCL(img, TOP = (topClr - 1))
; Show the results of the original region selection.
regionPts[roiPixels] = topClr
;WINDOW, 0, XSIZE = dims[0], YSIZE = dims[1], $
; TITLE = 'Original Region'
;TVSCL, congrid(regionPts,1024,1024)
; Grow the region. The THRESHOLD values are determined
; empirically.
newROIPixels = REGION_GROW(img, roiPixels, $
THRESHOLD = [200,255], /ALL_NEIGHBORS)
; Show the result of the region grown using
; thresholding. Black out all other pixels
regionImg = BYTSCL(img, TOP = 0)
regionImg[newROIPixels] = topClr
WINDOW, 2, XSIZE = dims[0], YSIZE = dims[1], $
TITLE = 'THRESHOLD Grown Region'
TVSCL, congrid(regionImg,1024,1024)
image = TVRead(Filename='wireframe2', /NODIALOG, /BMP)
image = READ_BMP('/home/users/fjosuna/CASVU_ISS/wireframe2.bmp')
OPENW, lun, 'wireframe2.dat', /GET_LUN
WRITEU, lun, image
FREE_LUN, lun
END
|