I'm using Signature capture in Mobile App and most of the time it works correct. I have offline capability for the App s o when the App is in offline mode, signature is captured and while sending to the server the image is going as black square.This is due to any data corruption at the mobile level or any issue in using the signature API. Please advise.
Code:
Image sourceImage = sign.getSignatureImage().scaledSmallerRatio(300, 100);
Image mute = Image.createImage(sourceImage.getWidth(), sourceImage.getHeight(), 0xffffffff);
Graphics g = mute.getGraphics();
g.drawImage(sourceImage, 0, 0);
test.setSignature(mute);
Base64.encodeNoNewline(EncodedImage.createFromImage(test.getSignature(),
false).getImageData())
Questions:
New Code leads to white spaces in the signature also. Signature looks like not renderingly properly. Please advise.
What is the code if I have to send the image as PNG to the server. I'm using following code:
Base64.encodeNoNewline(EncodedImage.createFromImage(act.getSignature(),
false).getImageData())
Make sure you are saving the image file as a PNG and not as a JPEG. The image file might contain transparency and some JPEG encoders might fail in that case.
To make the image "jpegable" (totally made that up right now) you can do the following:
// white mutable image
Image mute = Image.create(sourceImage.getWidth(), sourceImage.getHeight, 0xffffffff);
Graphics g = mute.getGraphics();
g.setAntiAliased(true);
g.drawImage(sourceImage, 0, 0);
Now you can save mute as a JPEG since it's an opaque white image. The black signature will appear correctly on top of that.
Related
I have added watermark on image using node_module 'gm', i had make font color grey but i found an bug in that if image content grey color so my watermark merged with image so i can't read the watermark text, that's why i want to create an overlay between image and watermark text but i don't know how i achieve it my current code is
const image = gm(__dirname+'/download.jpeg').fill('#ffffff').font('Arial', 10, '#ffffff').drawText(10, 20, "some text");
image.write('result.png', err => {
if(err) return console.error(err);
});
and i don't know how to make overlay between them my actual image is
and my watermarked image is
any help should be appreciate thanks in advance
So there is no such module that can give you the expected result.
But I faced the same problem & came across this module "node-caption" but again this module is also not giving us the expected result. So I have tweaked this module a little bit & made it work as expected.
Here is the URL to the modified module of my git hub repo https://github.com/mohsincynexis/node-caption.
The changes are only in the generate.js file.
Here is the attached image after watermark.
Inforamtion:
I have a simple ToF(Time of Flight) camera module provided by a vendor that only contains a Depth Node.
I've already setup the PCL environment and can compile and execute the sample code it provides.
The ToF camera module comes with a source code shows how to get depth raw data(the x, y, z value) from the hard device, but doesn't tell how to stream it as both point cloud image and depth image.
Win 7 64bit, Visual Studio 2008, PCL all-in-one 32bit.
As a result, I plan to use PCL to show the Point cloud image and depth image with the x, y, z data I can get from that camera module, further more, if streaming is possible.
However, as far as I know right now is that PCL tends to store all the point cloud data as a .pcd file, and then reads it thus output a point cloud image and a depth image.
It is obviously too slow to do the streaming in such way if I have to savePCD() and readPCD() every time in each frame. So I studied the "openni grabber" and "openni range image visualization" sample code and tried execute them, sadly "No device connected." is all I got.
I have a few ideas to ask for advises before I try:
Is there a way to use Openni on a device except Kinect, Xtion and PrimeSense? Even if it's just a device with no name and only has a depth node?
Can PCL show point cloud image and depth image without accessing a .pcd file? In other words, can I just assign the value of each vertex and construct a image?
Can I just normalize all the vertices and construct a image with barely Opencv?
Is there any other method to stream that ToF camera module in point cloud image and depth image?
1) Changing the OpenNI grabber to use your own ToF camera will be much more work than to just use the example from the camera in a loop shown below.
2) Yes PCL can show point cloud image and depth without accessing a .pcd file. What the .pcd loader does is to parse the pcd-file and place the values in the cloud format. You can do this directly from your camera data as shown below.
3) No idea what you mean here. I propose you try to use the pcl visualizer or cloud viewer as proposed below.
You can do something like:
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
cloud->isDense = true;
cloud->width = widthOfTOFsensor;
cloud->height = heightOfTOFsensor;
cloud->size = cloud->width * cloud->height;
//Create some loop
//grabNewFrame from TOFsensor
for(int pointIndex=0;pointIndex<cloud->size();pointIndex++)
{
cloud->points[pointIndex].x = tofSensorData[pointIndex].x; //Don't know the tofData format, so I just guessed something.
cloud->points[pointIndex].y = tofSensorData[pointIndex].y;
cloud->points[pointIndex].z = tofSensorData[pointIndex].z;
}
// Plot the data using pcl visualizer or cloud viewer, see:
http://pointclouds.org/documentation/tutorials/cloud_viewer.php#cloud-viewer
http://pointclouds.org/documentation/tutorials/pcl_visualizer.php#pcl-visualizer
I am a beginner in VTK ITK, I am trying to read a DICOM series with ITK and display with VTK but I had pictures upside down, I tried to read a single image (JPG) with ITK and visualuser with VTK it is the same problem, so I had the idea of treating the image on photoshop ie I applied to the original image rotation (vertical symmetry of the work area) and I did the reading with ITK and display with VTK, the image is displayed in the correct orientation, infact ITK keeps the orientation of the image, but the problem is at VTK, it is which displays the image upside down, I searched all over the internet I have not found a solution or a method or not even an idea, I encountered the same problem in many forums but there is no response, I count on your help, I can not apply any image processing to find a solution to this problem.
Please Help! thank you in advance
Ideally you should re-orient your camera in VTK so that it is suited for medical image visualization. (The default camera in VTK uses the computer graphics conventions).
If you want a quick hack, you can copy-paste the following code in ITK:
FlipFilterType::Pointer flipperImage = FlipFilterType::New();
bool flipAxes[3] = { false, true, false };
flipperImage = FlipFilterType::New();
flipperImage->SetFlipAxes(flipAxes);
flipperImage->SetInput( image );
flipperImage->Update();
I use a rapid way to set the orientation:
imageActor->SetOrientation(180,0,0);
No need to add filter.
Here's an example of how I would do it. I'm not sure what classes you are using, so I cannot be specific.
vtkSmartPointer<vtkImageData> result = vtkSmartPointer<vtkIMageData>::New();
result->DeepCopy(YourImage); //DeepCopy your image to result
rImage->Update();
double val;
int i = 0;
for(vtkIdType f = result->GetNumberOfPoints()-1; f > -1; f--)
{
val = YourImage->GetPointData()->GetScalars()->GetTuple1(f);
result->GetPointData()->GetScalars->SetTuple1(i,val);
i++;
}
result->Update();
//Now Visualize your image
Imagine that i have a client that only can read base64 images and i want to show that images like a realtime movie (as less latency as possible).
This images are created on server side using nodejs canvas lib. For each image that i send to the client i see the difference between them with imagediff nodejs lib and i only send the difference match image.
In the client side i show it putting the last image exactly over the previous ones (layers).
The problem is that in server side i have the following values that slow down the process:
16ms: after draw canvas:
42ms: imagediff (imagediff nodejs lib)
[100 to 250ms] - toDataUrl (canvas to png base64 - canvas nodejs lib toBuffer().toString('base64'))
The big issue is in 3.
Do you have a different solution for this?
Thanks for your time.
Eduardo
I'm trying to include OpenCV (version 2.3.1) in a project I'm working on. A camera is sending my program (in Microsoft Visual C++ 2008 on a Windows 7 64-bit machine) an image stream, which the program stores in an unsigned 8-bit integer buffer. I would like to display this stream in a window using OpenCV. Right now, I can't seem to get any images to display in my OpenCV windows, so I'm not using my image stream yet; just a JPEG file.
First I declare my window:
namedWindow( "Window", CV_WINDOW_AUTOSIZE );
Then I try to fill it:
char* imgName = "C:\...\Jellyfish.jpg";
Mat imgMat = imread(imgName, 1);
if(imgMat.data)
{
imshow( "Window", imgMat );
}
When my program gets to the point where the window gets declared, a tiny gray window appears. When it reaches the point where it is supposed to display the image, the window's dimensions change to that of the image (I've tested this with different images) but the inside of the window remains a plain gray box.
What is causing this strange error? The program obviously found the image, or it would not have been able to change its dimensions correctly.
You need to add waitKey(2) function call after the imshow.
From OpenCV documentation for waitKey:
This function is the only method in HighGUI that can fetch and handle
events, so it needs to be called periodically for normal event
processing unless HighGUI is used within an environment that takes
care of event processing.
Without this function Windows is unable to handle PAINT event and redraw your window.