HTML5 Capture Attribute on devices image get rotated [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have used html5 camera capture attribute, when user try to capture image from the devices image gets rotated
Do we need to provide any setting on this?
Can we correct the image rotation using C#?

We are successfully using the following code to capture images and it works fine:
var canvas = document.getElementById("canvas")
var video = document.getElementById("video")
// Start video code omitted...
// Capture function
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext("2d").drawImage(video, 0, 0);
var imgData = canvas.toDataURL("image/jpeg")
The image should be fine unless there is some specific hardware configuration not allowing this.
And yes, it is possible to rotate the image using C#. Google it.

Related

How can I extract written number in a answer sheet(image) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I tried tesseract but it only works on pure text document, can anyone suggest me what to do?
Here is my code for vb.net
Dim pic = New Bitmap(OpenFileDialog1.FileName)
Dim ocr = New TesseractEngine("./dataset", "eng", EngineMode.TesseractAndCube)
Dim page = ocr.Process(pic)
TextBox1.Text = page.GetText
It looks like your answer sheet is well structured. I would focus on extracting a sub-image for each answer, and then running Tesseract in single character mode on that image.
I'm not sure how you get single character mode in whatever Tesseract wrapper you're using, but via command line it's the parameter: --psm 10.
To extract each image, I would use OpenCV (try Emgu for .NET). You may need to first apply a perspective wrap in order to get the image square. You can then use a simple sliding window to get each sub image.
I'm not sure how this will perform in cases where an answer has been crossed out.

Is .tif image multipage or not? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a simple question (I hope it is simple for someone). How could I recognize is .tif (or .tiff) image contains two or more pages, or it is just one image (one "page"). I use .NET. For what? I have an image as input and should process it in some way, and if image consists of several images - choose one method, just one image - another method. I am waiting for any free solution (it can be just .net or any free third-party library). I don't need to split tiff or any other good thing, just something like
Boolean isMultipage = SomeLibrary.IsTifMultipage(filePath);
Thanks!
You could write a method that would determine that for..Perhaps something like this?
public bool IsMultipage(string fileName)
{
using (Image imageFile = Image.FromFile(fileName))
{
FrameDimension frameDimensions = new FrameDimension(imageFile.FrameDimensionsList[0]);
return imageFile.GetFrameCount(frameDimensions) > 1;
}
}

How to split an image into 12 different custom shape in unity3D or c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm developing game in which I choose picture from the gallery and then what I need to do is cut it into 12 custom shape part which will be used then as a puzzle I need those 12 piece to merge together and create the same.
Edit: To those who don't understand the question what i'm trying to accomplish is trying to split an single image into different part and then player will figure out the sequence of part and make the image.
I want the player to add the picture from his/her collection to make it more challenging and challenge others player.
A picture will make it more clear but as I don't have enough credit and i'm getting -ve one in this i don't know how to put it more clearly in the reader mind.
A possiblilty for which you are looking for is masking feature of UI components. You can deal with the flag Show mask graphics to show/hide the relative parts.
You can use Graphics.DrawImage to draw a cropped image onto the graphics object from a bitmap.
Rectangle cropRect = new Rectangle(...);
Bitmap src = Image.FromFile(fileName) as Bitmap;
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using(Graphics g = Graphics.FromImage(target))
{
g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
}

How do i make a parallax background? C# Monogame? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I searched everything on the internet but I cannot find a way to make a simple parallax background for my title screen.
In general, a way to show a horizontally repeating background that should work with any library capable of showing images:
image is a background image.
image2 is a second copy of the background.
On update:
// Move the background to the left.
image.x -= PerUpdateDeltaX;
// If the background is off the screen, move it back on.
// You can use modulo/remainder to do this better.
if (image.x < -image.width)
image.x = image.width;
// Put the second image to the right of the first.
image2.x = image.x + image.width;
To make this look good, the edges of the background image that touch need to be seamless.
Then, to make parallax (where there appear to me multiple layers moving in 3D), just add in a few more things:
Transparency.
More pairs of repeating background images, one pair for each layer of parallax.
Different PerUpdateDeltaX values for each layer. To look good, the higher/closer layers should move faster than lower layers.

How to display images in a list view? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My knowledge is stored in sql server eg a sample of the data in the list view show like this, I wrote:
item.SubItems.Add(dr["Fname"].ToString ());
A statement that I wrote when I was on the field list, click on the text box was shown Vaio example:
Vfname.Text = e.Item.SubItems[1].Text;
It is not clear what you are trying to do, but I assume you should add Image objects to your List View, using System.Drawing.Image.FromFile(), then draw them calling Graphics.DrawImage, passing the image file you have in the listview.
http://msdn.microsoft.com/en-us/library/42807xh1(v=vs.110).aspx
Image newImage = Image.FromFile("SampImag.jpg");
// Create Point for upper-left corner of image.
Point ulCorner = new Point(100, 100);
// Draw image to screen.
e.Graphics.DrawImage(newImage, ulCorner);

Categories