import astropy.io.fits as fits from astropy.nddata.utils import Cutout2D # Open the FITS image fits_image = fits.open('fits_image.fits')[0] # Create a Cutout2D object cutout = Cutout2D(fits_image, (100, 100), (200, 200)) # Extract the cropped image cropped_image = cutout.cutout() # Save the cropped image to a new FITS file fits.writeto('cropped_image.fits', cropped_image)
Hi your vedio was veryy useful.really tq for this. How should we write the code so that I need to save the cropped images in a folder with a particular name.
Hi! Thank you for your video, i have question, if we have large dataset which include some images in it and we want to automatically crop it how we can do that? Since the position of each image may be different. Thanks!
You can use masking and then crop object using bounding boxes. If you not bothered about cropping and want to resize all images to same size the. You can use keras image generators to load images from folders
My question may irrelevant to your video... I can easily open images and work on them but I have no clue how to NOT OPEN IMAGE but when you run your app it asks you to crop any area of current screen and once you crop image by mouse that image saves in the drive and you can work on it. So instead of refrencing image file location (every video has file location reference) you actually crop a portion of the screen and then work on it Any idea where to start? Thanks
Video is nothing but collection of images in sequence. When you read video in program you actually read the images in sequence from that video. You can write code to crop the each frame/image as per you choice in loop. At the end result you will find your video cropped with provided size.
@@DataMagicAI Thanks for replying... I had nothing to do with videos. I wanted to know that... is there a workaround that instead of referencing image location like here in this video on line 28 you give location... "image = cv2.imread("c:\images\obama\obama1.jpeg")" So instead of giving location for image. When we run app it will ask to select (crop) a portion of current screen by mouse and then that portion is cropped and shown
how can i crop a fits image using python
import astropy.io.fits as fits
from astropy.nddata.utils import Cutout2D
# Open the FITS image
fits_image = fits.open('fits_image.fits')[0]
# Create a Cutout2D object
cutout = Cutout2D(fits_image, (100, 100), (200, 200))
# Extract the cropped image
cropped_image = cutout.cutout()
# Save the cropped image to a new FITS file
fits.writeto('cropped_image.fits', cropped_image)
Hi your vedio was veryy useful.really tq for this. How should we write the code so that I need to save the cropped images in a folder with a particular name.
Thank you ! For your query, Please checkout below episode - ua-cam.com/play/PLTmQbi1PYZ_GrjMHiGCYa0WyDZfxu-yTz.html
Thank You Sir!
Most welcome!
Hi! Thank you for your video, i have question, if we have large dataset which include some images in it and we want to automatically crop it how we can do that? Since the position of each image may be different. Thanks!
You can use masking and then crop object using bounding boxes.
If you not bothered about cropping and want to resize all images to same size the. You can use keras image generators to load images from folders
My question may irrelevant to your video...
I can easily open images and work on them but I have no clue how to NOT OPEN IMAGE but when you run your app it asks you to crop any area of current screen and once you crop image by mouse that image saves in the drive and you can work on it. So instead of refrencing image file location (every video has file location reference) you actually crop a portion of the screen and then work on it
Any idea where to start?
Thanks
Video is nothing but collection of images in sequence. When you read video in program you actually read the images in sequence from that video. You can write code to crop the each frame/image as per you choice in loop.
At the end result you will find your video cropped with provided size.
@@DataMagicAI Thanks for replying...
I had nothing to do with videos.
I wanted to know that... is there a workaround that instead of referencing image location like here in this video on line 28 you give location...
"image = cv2.imread("c:\images\obama\obama1.jpeg")"
So instead of giving location for image. When we run app it will ask to select (crop) a portion of current screen by mouse and then that portion is cropped and shown
This helped a lot ! Thanks!
Your welcome !
Thankyou
Your welcome!