Removing Unwanted blob in image - image

How can i remove unwanted blob from this image so that only text area is visible in the image?Image with unwanted blob

If what you are looking for is always text, I suggested first applying an OCR to recognize the text.
I=imread('image'jpg');
ocrResults = ocr(image);
Iocr = insertObjectAnnotation(image, 'rectangle', ...
ocrResults.WordBoundingBoxes, ...
ocrResults.WordConfidences);
figure; imshow(Iocr);
And the result should be something like this:
After you apply OCR, in the variable ocrResults you will have a field that will be CharacterBoundingBoxes, where through this you can create a binary mask of ones (on the position of the boxes) and erase everything else (zeros). Of course some noise will be detected as text, but if you work a bit with morphological operations as explained above (bwareaopen) you will have better results.

Related

Trying to get rid of remnant white space after hiding images

I have multiple images in the column portion of a matrix that displays the image if there is one. If there is not an image defined for the image number, the report correctly hides the image (as the BorderColor = Black is not shown) but the white space still remains.
I have tried every possible combination (except the correct one obviously) to no avail.
My objective is to only have the width of the 8 images be 2
Any Ideas?...And splitting the images into individual lines is not an option as it negates the whole premise of using the Matrix.
I have tried placing the hidden code in every possible Hidden field in the report. All postings found all refer to a SINGLE image and not MULTIPLE images.

Removing white space below image in RMD file for PDF Output

I am working in R Markdown to create a PDF Output and trying to fit my outputs to a single page. I'm a bit over at the moment, and want to remove the extra white space around an image.
knitr::include_graphics(("File_Name.jpeg"))
I have tried par(mar(c(0,0,0,0)) which seemed promising based on the description here but that seems to scale the image.
I also tried using out.width but that didn't seem to impact the image at all.
Two steps resolved this for me.
First, I added the code below to the ggplot code which was creating the original graph image in a separate r script file, that I was saving and later inserting into the rmd file.
plot +
theme(plot.margin = margin(0, 0, 0, 0, "cm"))
This helped to reduce the margins but there was still an extra space at the bottom which appeared in PDF Output files between blocks.
So, Second, following the guidance in https://stackoverflow.com/questions/59640925/rmarkdown-how-to-reduce-space-between-title-block-and-start-of-body-text
I added the code below after inserting the image (right before the first set of text) to reduce the extra spacing Markdown adds between blocks.
\vspace{-5truemm}

How to insert my 1:100 draw from Autocad into a Word document

I must to insert an 1:100 image I did in Autocad inside a Word document. I just printed in PDF format and it fits a A4. I could do a print screen, paste it on the Word page and crop the boundaries, but it need some very sketchy adjusts to put it back into the correct scale. Also the lines does not render very well. I believe there is a better and correct way to do.
I guess my first question would be, "Why do you need to insert the file into a word document?"
If you must insert it into a word document, you should use the Insert Object process described here -->PDF into Word Doc.
This would never be my preferred method though. I would rather convert the word document to PDF and then insert my scaled PDF drawing into the exported word doc PDF. This would keep the integrity of your drawing scale intact.
Just my two cents, which won't get you much.

Matlab gui image incorrectly blue

I am creating a GUI containing an image using the following code:
try
Imagenamehere = imread('Imagenamehere.jpg');
axes(handles.Logo)
image(Imagenamehere)
set(gca,'xtick',[],'ytick',[])
catch
msgbox('Please download all contents from the zipped file into working directory.')
end
The image shows up but for some reason is completely coloured blue as if put through a blue filter. I don't think it would be wise to upload the image but it is a simple logo coloured black and white.
Anyone know what could be causing this?
Check the size, type (probably uint8) and range of your image. It sounds like for some reason your images are being displayed with colormap as jet (the default), and possibly also that your range is not what MATLAB expects (e.g. 0 to 1 not 0 to 255), resulting in all your values being relatively low (blue on the jet colormap).
"black and white" is just one way of interpreting an image file which contains only two colors. MATLAB makes several assumptions when you pass data into a display function like image. If you don't specify colormap and image data range, it will make a guess based off things like data type.
One possibility is that your logo file is an indexed image. In these cases you need to do:
[Imagenamehere map] = imread('Imagenamehere.jpg');
colormap(map);

iTextSharp stamper wraps text

I'm using iTextSharp to fill in some stamper AcroFields.
stamper.AcroFields.SetField("Title", "Lipsum");
I created the pdf in illustrator and the form fields with Adobe Acrobat X Pro. The problem is that although the text fields are the width of the page, in the saved pdf the text wraps at about 1 third of the width.
Another question would be if it's possible the have the textfield autoSize in height, or a way to handle the overflow of the text.
1) I'd like to see that PDF. I suspect the fields aren't as wide as you think they are.
2) You can set a field's font size to zero to enable "auto sizing", which works both within Reader and iText. However, it sizes to the actual field size, not what you think it might be.
I'm guessing you drew a spiffy form field background in Illustrator, then put a field over it in Acrobat Pro, but didn't size the field width to match the spiffy illustrator background. Could be wrong, but that's my hunch.
That's the flattened PDF. Can I see the original with the form field still intact? Sorry I wasn't more specific. None the less, I can learn a little from reading this PDF:
Looking at the bounding boxes for the flattened field XObject and it's internal clipping rectangle, it looks like it should be using most of the page:
The page is ~600 points wide by ~850 tall.
The flattened field XObject is ~560 points wide by ~100 tall.
I wonder if there's some non-standard carriage return characters in your text that iText picks up on by Acrobat does not...
Anyway, I'd like to see the unflattened PDF. Filled in is good, but not flattened.
Okay, looked at the template. I don't see anything that would cause the line breaking you're seeing... which makes me think my second guess was right: new line characters.
Looking at the text layout code might give me a hint. Each of your lines of text goes like this (for example):
1 0 0 1 2 88.24 Tm 0 g (Die Semmerrolle der l{e4}nge nach zu einer grossen Roulade)Tj
n n n n n n Tm: text matrix
g: gray (0 g: black)
(...)Tj: show text
That's consistent with the code path when you set a text field value in the trunk of iText (and the most recent release[s]). That code (ColumnText) is quite good at breaking text properly, and used all over the place. The bounding box is correct (as shown in a couple places of the flattened PDF).
Check your input.

Resources