I want to make custom dataloader in pytorch which first reads all first image, then second image and so on from all folders with augmentation - loader

I need a dataloader in pytorch which reads first image, then second image and so on using custom labels
I tried but error occured

Related

Fill Broken and Damaged Texts - OPENCV

I am trying to extract the text from an image using openCV and tesseract.
Since, we need to pass a clean image to tesseract to fetch the text properly with accuracy. But I am facing an issue related to preprocessing of an image using opencv.
How can i join the texts and get proper text to to pass to the tesseract?
image1(ORIGINAL IMAGE)
image2(PROCESSED IMAGE).

Add Background image to 3D Plotly - Python

I have been trying to add an image to my 3D surface plots on Plotly; where the image is stored in a local file and I give the file path as an input to "source" in go.Layout; but it does not show up and shows no errors.
Plotly background images this doesn't work for me either; can someone explain it a bit more!
The final plot could look like this https://plot.ly/~empet/14397/plotly-plot-of-a-map-from-data-available/#/ where instead of json file,I just want to add am image.

How do we load and resize image using tensorflow?

I have just downloaded the dataset caltech101 and I want to resize the image into the shape of (200,300,3). As I have read, I first need to convert the image into a tensor and then resize it using tf.image.decode_jpeg. But I don't know how to start from scratch with an image and turn it to a tensor.
(I'm a beginner in learning machine learning)
To load an image using TensorFlow, first decode it like so:
image = tf.image.decode_jpeg(...)
To resize it, use the image from the code above, like so:
resized_image = tf.image.resize_images(image, [299, 299])
You can find more on their API documents here.

Saving grayscale image as it appears in jet colormap

I have grayscale satellite image which is processed from spectral data (band classifications). If i use jet colormap in imshow it will show absolute colormapped image. But if i try to imwrite in particular place it is saved like a bluish image. I saw one example in matlab central, but i didnt get. can anyone help me to write my image with colorscaled image.
Matlab central link: http://www.mathworks.in/matlabcentral/answers/25026-saving-grayscale-image-as-it-appears-in-jet-colormap-of-imagesc
there accepted answer link is : http://www.mathworks.com/matlabcentral/fileexchange/7943
I have tried many times, this will show colormaped images in plots (imshow) they didnt write anywhere with colormaped. Now i want to write my image with colormaped.
example code:
I= imread('image path');
imshow(I,'colormap',jet);
imwrite(I,'path','jpg'); /not working
or
imwrite(I,jet,'path','jpg'); /not working
Please help to solve this issue.
When you use imshow the colormap is always adjusted to the range of values in your image. imwrite however assumes your image has a value range of [0,1] if you are using single or double data types. Try to scale your image to the range [0,1] before saving.
If you provide a colormap in the call to imwrite, MATLAB assumes you are using an indexed image. Thus you will have to convert the image to the indexed format first. The following snippet worked for a test image I of mine:
% scale to [0,1]
I = I - min(I(:));
I = I ./ max(I(:));
% Create indexed image
[J,~] = gray2ind(I);
% Save image
imwrite(J,jet,'path','jpg');
Solution by hbaderts worked well for me, but later I found out that some images were still scaled slightly different way from imshow.
However, I might found a reason of an original problem. Just after Matlab starts, its default colormaps (including 'jet') are set to 64 colors (64x3). Then, if any image is shown with a colormap, for example if imshow('cameraman.tif'), colormap('jet') is executed, all default colormaps become 256x3 (can be verified with jetMap=jet; before and after). Then it might happen that an image was written with a colormap different from the one applied to image figure (for example, if a figure called after imwrite).
Finally I found this solution (no image pre-scaling needed):
% Create indexed image, explicitly using 256 colors
imInd=gray2ind(im,256);
% Convert indexed image to RGB using 256-colors jet map
jetRGB=ind2rgb(imInd,jet(256));
% Save image
imwrite(jetRGB,'jet.png');
The images I used have the same color scale now, both the saved one and the one shown in figure.

How to subset raster image using gdal?

I have read pixel values of an raster image using GDAL libraries in visual studio 2010(vc++).
Next is , I have to crop the image (subset) according to the grid given in shape file.
Forget about the grid this time.
I just want to clip square or rectangular area and save to new file.
I have read some documents which suggest about gdal_translate and gdal_warp function to use but it can only be run in python where as i want to use c++.
Please help me as early as possible.
I have solved the problem of cropping the image using VC++ with gdal libraries. I have created VRTDataset of my desired size of raster to be cropped and then save it using CreateCopy().

Resources