Google Earth Engine (gee) reduceResolution() tile size error - resampling

I'm trying to rescale an image (30 to 100m spatial resolution) using reduceResoluton().reproject() functions in Google Earth Engine (GEE). What I wanted is calculating the mean values of the 30 m image into the new 100 m resolution image.
I have tried the following
var img_100 = img_30.reduceResolution({
reducer: ee.Reducer.mean(),
bestEffort: true,
maxPixels: 10,
})
.reproject({
crs: 'EPSG:4326',
scale: 100
});
I have used one Landsat scene and it prompt the tile error "Tile error: Output of image computation is too large ":
error
Am I missing something? Is there another way of performing this task?
Thank you all very much

It turns out I had to export as an Asset, and then import the image again.
Not sure if this is the best practice but worked out fine.
If someone has an alternative please let us know.
Thanks!
Export.image.toAsset({
image: img_100,
description:'img_100',
scale:100

Related

PIXI js - Pixel Data is Zero

I'm currently working on a little game written in JS using Pixi.js(https://github.com/pixijs). One Problem has occured currently, I'm trying to implement pixel exact collision between shapes, while I was programing a little I noticed that all the pixel RBGA values of my images are just 0.
I searched on the web but for a while but the only reason for those Problems I could find was that the canvas was tainted because of CORS(Pixel RGB values are all zero).
But this can't be the reason in my case because I created the sprites myself, I'm not loading them from other (any) domains or something like that.
Could this be a problem with the images? How do I avoid that? I will append some code that works if I use other images (some images I downloaded for tests).
const app = new PIXI.Application({width: 500, height: 500});
document.body.appendChild(app.view);
PIXI.loader.add("sprites/test.png")
.load(() => {
let img = new PIXI.Sprite(PIXI.loader.resources["sprites/test.png"].texture);
app.stage.addChild(img);
console.log(app.renderer.extract.pixels(img));
});
Edit: I tried getting the RGBA values using a short Java Program btw, same problem. Every single value is zero.

detect face from cctv image

My requirement is i need to detect human face from the given cctv image. In the cctv image there will be unnecessary objects which need to be removed.if the obtained face image is blur needs to improve the quality as well
currently we are trying with opencv API, the code as follows
CascadeClassifier cascadeClassifier = new
CascadeClassifier("haarcascade_profileface.xml");
Mat image=Highgui.imread("testing.jpg");
MatOfRect bodyDetections = new MatOfRect();
cascadeClassifier.detectMultiScale(image, bodyDetections);
for (Rect rect : bodyDetections.toArray()) {
BufferedImage croppedImage = originalPic.getSubimage(rect.x,
rect.y,rect.width,rect.height); **unable to detect the body coordinates
here**
}
In the above approach multiple objects of the image are detected as face,which is error.
In the cctvc image if there is only side face how to extract the complete face ?
Pls suggest the best possible way to achieve my requirement.
Thanks
IMGen
You may want to look at the new AWS solution
https://aws.amazon.com/blogs/aws/category/amazon-rekognition/

Scale image using Appcelerator Titanium

Is there some easy way to scale an image to a maximum size?
Looking for some some easy way to keep file sizes down and scale images that are uploaded from the app to max 640 width for example.
I have googled several solutions, from module Ti.ImageFactory to just put it into an ImageView with a size, and get the blob back again (which should make it scaled?). The Ti.ImageFactory module seems very old though, several years ago updated if you look at GIT. Also the zip files for download seems to be missing on git...
Ex.
Titanium.Media.openPhotoGallery({
success:function(event)
{
Ti.API.info('Our type was: '+event.mediaType);
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
{
// HERE event.media needs to be scaled to a max
// size... for example 2 MB data, or max 960 px
// width/height or something similar
uploadPhoto(event.media);
}
},
cancel:function()
{
Ti.API.info("Photo gallery cancel...");
},
error:function(err)
{
//Ti.API.error(err);
Ti.API.info("Err: "+err);
alert(L("AN_ERROR_OCCURRED"));
},
mediaTypes:[Ti.Media.MEDIA_TYPE_PHOTO]
});
What you are looking for is the function imageAsCropped or  imageAsResized.
Let me know if you need Further help.
You can use the size property.
size : Dimensionreadonly
The size of the view in system units.
Although property returns a Dimension dictionary, only the width and
height properties are valid. The position properties--x and y--are
always 0.
To find the position and size of the view, use the rect property
instead.
The correct values will only be available when layout is complete. To
determine when layout is complete, add a listener for the postlayout
event.
Documentation Link
I ended up using ti.imagefactory module.
The zip files for android and ios I found here:
https://github.com/appcelerator-modules/ti.imagefactory/releases
Example can be found here:
https://github.com/appcelerator-modules/ti.imagefactory/blob/stable/ios/example/app.js
I used code from the examples in my app and it seems to work fine!

Detecting face very fast from video using vision.CascadeObjectDetector in matlab

I wrote matlab code for face detection.In my code it is detecting face for first 100 frames and it crop faces from each frame and saves it in database folder.Problems iam facing
1.Detecting frame by frame is very slow.Is there any idea to run faster since i have to work on 4000 frames.
2.In my database folder it has to show 1 to 100 face images but it is not showing 11th and 12th face images directly it showing 13th face image after 10th image.23rd face image is blurr.Likewise so many images are missing and some are blurr.Last image number it is showing as 216.But total 106 face images are there in database folder.In that 12 images are blurr.Remaining are correct images.
clc;
clear all;
obj=vision.VideoFileReader('basu.avi');
for k=0:99
videoFrame = step(obj);
%using viola-jones algorithm
FaceDetect = vision.CascadeObjectDetector;
%FaceDetect
BB = step(FaceDetect,videoFrame);
%BB
figure(2),imshow(videoFrame);
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',3,'LineStyle','-','EdgeColor','r');
end
%crop faces and convert it to gray
for i = 1:size(BB,1)
J= imcrop(videoFrame,BB(i,:));
I=rgb2gray(imresize(J,[292,376]));
%save cropped faces in database folder
filename = ['G:\matlab_installed\bin\database\' num2str(i+k*(size(BB,1))) '.jpg'];
imwrite(I,filename);
end
end
There are a few of things you can try:
Definitely move FaceDetect = vision.CascadeObjectDetector; outside of the loop. You only need to create the face detector object once. Re-creating it for every frame is definitely your performance bottleneck.
vision.VideoFileReader returns a frame of class 'single' by default. If you change the output data type to 'uint8', that should speed up the face detector. Use obj=vision.VideoFileReader('basu.avi', 'VideoOutputDataType', 'uint8');
vision.VideoFileReader can also do the conversion to grayscale for you. Use obj=vision.VideoFileReader('basu.avi', 'VideoOutputDataType', 'uint8', 'ImageColorSpace', 'Intensity'); This may be faster than calling rgb2gray.
Try limiting the size of the faces being detected using 'MinSize' and 'MaxSize' options of vision.CascadeObjectDetector and/or try downsampling the frame before detecting faces.

image is too big to fit in the screen (MATLAB)

I got an error in Matlab which is
Warning: Image is too big to fit on screen; displaying at 33%
and my source code for this part is this :
watermarked_image_uint8=uint8('watermarked_image');
%# write watermarked Image to file
imwrite(watermarked_image_uint8,'watermarked_image','jpeg');
%# display watermarked image figure(1)
imshow(watermarked_image), title('Watermarked_Image')
Can any one help me please to debug this warning?
It's not an error, just a warning that the resolution of the image you are showing is larger than the resolution of your Matlab window, so Matlab has to reduce the size of the image before displaying it.
It has nothing to do with your code, and it won't effect your results, so you can safely ignore it.
As Ghaul said, the warning is nothing to worry about. Use the InitialMagnification argument to imshow to make your image smaller, or turn the warning off, if it annoys you.
You should probably try to change the resolution of your image so that it would fit in your screen. To check for your screen resolution check this site :
http://www.whatismyscreenresolution.com/
Try using images with lower or the same resolution with your monitor. To change the resolution of your image you can use paint or any photo editors.
Hope it helps.
I guess you could do something like get first the size of the screen, create a figure and then set the your window size, for example:
plot_size = get(0,'ScreenSize');
fg = figure(1);
set(fg, 'Color', [1 1 1], 'Position', plot_size, 'Visible', 'on');
imshow(watermarked_image),
title('Watermarked_Image')
this is simply warning you are facing, so either identify the unique number of warning and then suppress it or you can use
imshow(watermarked_image, 'InitialMagnification', 50);
this will help you to reduce the size of your image and fit it on the screen.
I also found this error when running from the command line with the -nodisplay argument (what I really wanted was -nodesktop).

Resources