http://www.2d3dfloorplans.com/wp-content/themes/default/images/2dfloorplans_1.jpg is my input image. I would like to remove texts from this image. (For ex. Bedroom, 11'X12', Closet...). Note: I want to remove automatically. Not manually.(When I run my code. Texts will be removed. I won't remove manually).
If you know all the possible text variations, and there not too many of them, (individual words can be split) then you can detect them using template matching technique. Once a word is detected you can overlay it's region with a background color.
http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html
suggested code stucture:
program/
samples/
sample1.png # image with a "Bedroom" text
sample2.png # rotated image with "Bedroom" text
sample3.png # ...
sample4.png # etc
src/
main.cpp
readme.txt
makefile
main reads image from argv and applies each template from samples folder to it. Once text is found it then uses some logic to overlay the occupied region.
Try to run an OCR algorithm on the images and delete the regions detected by the OCR algorithm.
Related
Based on the answer to this question, I was able to get 2-column papaja with listings wrapping (rather than overflowing column width). But the listings package turns off various features that help code listings and R output stand out relative to the main text.
A simple solution would be if I could globally change the font faces and/or sizes selectively for code and R output. Is there a way to do that in papaja? I haven't been able to figure this out from papaja or Rmarkdown documentation. Thank you!
When you use the listings package in a papaja (or bookdown) document, what is technically happening is that all code is wrapped into an lstlisting LaTeX environment that comes with its own capabilities of customizing code appearance. Hence, you don't see the syntax highlighting that you would otherwise see if you would not use the listings package. The documentation of the listings package with instructions how to style your code can be found here.
To make use of this, you can extend the YAML header of your papaja document like this:
documentclass : "apa6"
classoption : "jou"
output :
papaja::apa6_pdf:
pandoc_args: --listings
header-includes:
- \lstset{breaklines=true,language=R,basicstyle=\tiny\ttfamily,frame=trB,commentstyle=\color{darkgray}\textit}
Here, I first specify the code's language, and use a tiny monospace font. With frame, I add a frame around the code block, and with commentstyle I set comments in italic and gray.
I have added a big PNG (tall, with similar aspect ratio to A4 paper) image in my rmd between two paragraphs using the following chunk (caption was made that way since it will include citations):
(ref:cap-etlm) The ETLM.
```{r etlm, results = "asis", echo = FALSE, fig.cap = "(ref:cap-etlm)", out.width='\\textwidth'}
include_graphics("figures/etlm.png")
````
The problem is, when generating a pdf output, the previous page becomes sparse, with many empty lines (shown with red lines):
This (could) also be the case if the image didn't take the whole page, but was large enough.
How can I let some of the text (that, in the rmd, have been written after the chunk/its reference) appear before the image?
Thanks in advance.
Edit:
This Gist is rmd of a minimal reproducible example (updated screenshot). It also requires csl files, etc., which are in a zip file here on TinyUpload.
Your file template.tex contains the following lines:
\usepackage{float}
\floatplacement{figure}{H}
This forces LaTeX to place figures always HERE, i.e. where they are defined. Removing these two lines solves the problem for me.
I'm trying to save a large number of images in JPEG format. Each file combines 2 layers visible on the screen. To achieve this, I've recorded a simple action that saves the file as X.jpg. I don't mind the fact that it saves the next file as X copy.jpg, but the problem occurs when trying to save the 3rd image (and other consecutive images), as instead of creating another file, it replaces the previous X copy.jpg file with the 3rd image.
Does anyone know how to instruct it to keep creating new files instead of rewriting the X copy one?
I'm new to creating Sublime Text 3 Plugins and I'm trying to understand the Plugin API that's offered. I want to be able to "grab" text I highlight with my mouse and move it somewhere else. Is there a way I can do this using the Sublime Text Plugin API?
So far, all I've done is be able to create a whole region:
allcontent = sublime.Region(0, self.view.size())
I've tried to grab all of the text in the region and put it into a lot file:
logfile = open("logfile.txt", "w")
logfile.write(allcontent)
But unsuccessfully of course as the log file is blank after it runs.
I've looked over google and there is not a lot of documentation, except for the unofficial documentation, in which I can't find a way to grab the text. Nor are there many tutorials on this.
Any help is greatly appreciated!
A Region just represents a region of text (i.e. from position 0 to position 10), and isn't tied to any specific view.
To get the underlying text from the view's buffer, you need to call the view.substr method with the region as a parameter.
import os
logpath = os.path.join(sublime.cache_path(), 'logfile.txt')
allcontent = self.view.substr(sublime.Region(0, self.view.size()))
with open(logpath, 'w') as logfile:
logfile.write(allcontent)
print('written buffer contents to', logpath)
To get the region represented by the first selection, you can use self.view.sel()[0] in place of sublime.Region(0, self.view.size()).
i try to make a signature inside a latex template with a hand written signature image from a png. I like to place it on a line with the name as text beneath. I've tried to make it with a table, but i failed to place it directly on the line. I hope someone can help me here.
I uploaded a example image how it should look like: example image