It would be great to just put a GLSL shader in configs that will denoise a video.
I tried putting the line "denoise=1" in mpv.conf but it didn't work: on Windows 10 "Error parsing option denoise (option not found)". With Linux I don't remember if there was an error, but I couldn't see anything noticeble.
Related
I am using the OCRTesseract extra module in openCV for text recognition on a raspberry pi model 3. I want it to only detect single, uppercase characters. The following initilization code works perfectly fine on my desktop and laptop:
Ptr<OCRTesseract> tess;
tess = OCRTesseract::create(NULL, NULL, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 3, 10);
however when run on the run on the raspberry pi it seems to ignore the filters and will often give lowercase characters and symbols. Occasionally giving multiple characters at the same time.I have tried:
tess->setWhiteList("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
to no avail.
Any suggestions? The OCR works fine apart from this issue. Allowing it to detect lowercase letters/symbols is resulting in a lot more false positives than I am happy with.
I do not have the rep needed to comment. My guess would be a faulty installation of tesseract or opencv in your pi considering the fact that it ignores the whitelist and give multiple character when psm is set to 10 (single character).
Can you provide the version of your tesseract and opencv?
If possible, try to save the image as a file then use tesseract from command line to see whether it works properly.
After doing some research I found it to be a bug in tesseract version 4.00.00alpha (which just so happened to be the version I was running on the PI).
Setting the OEM mode to 0 completely fixed the issue. The following initilization code works as intended:
Ptr<OCRTesseract> tess;
tess = OCRTesseract::create(NULL, NULL, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0, 10);
I have been trying to get into DirectX programming lately (with C++/Win32), and I encountered some issues.
A friend programmed a very simple random terrain generator that works with Perlin Noise, so I tried to grab his code and make a DirectX 11 renderer for it, but my program throws an "Microsoft C++ Exception", _com_error when I run it.
Even wierder, the program breaks at different lines of code depending on the build type...
On Debug, the program breaks on this chunk of code:
// Load the pixel shader
std::ifstream pixelFile("pixel.cso");
if (!pixelFile)
return false;
std::string pixelContents((std::istreambuf_iterator<char>(pixelFile)),
std::istreambuf_iterator<char>());
pixelFile.close();
if (FAILED(mpDevice->CreatePixelShader(pixelContents.c_str(),
pixelContents.size(),
NULL,
&mpPixelShader)))
return false;
And on Release:
// Create and set the input layout
if (FAILED(mpDevice->CreateInputLayout(layoutDescription,
layoutDescriptionSize,
vertexContents.c_str(),
vertexContents.length(),
&mpVertexLayout)))
return false;
mpPixelShader is a member of type ID3D11PixelShader*, and mpVertexLayout is a member of type ID3D11InputLayout*.
Of course, the first thing I thought when I saw that the error was different was checking for memory corruption, and sure enough I found one in my friend's code after running ApplicationVerifier and setting the _crtDbgFlag, but it is fixed now and I still have this error...
The application ran fine when the rendering initialization function was filled with a modified version of the one found on the MSDN Win32 DirectX Triangle Tutorial too.
The cso file is not a text, it is a binary file. A std::string will not work, the file will contains bytes that are 0.
This is driving me up the wall..
I've got a very simple SDL2 program.
It has a array of 3 SDL_Texture pointers.
These textures are filled as follows:
SDL_Texture *myarray[15];
SDL_Surface *surface;
for(int i=0;i<3;i++)
{
char filename[] = "X.bmp";
filename[0] = i + '0';
surface = SDL_LoadBMP(filename);
myarray[i] = SDL_CreateTextureFromSurface(myrenderer,surface);
SDL_FreeSurface(surface);
}
This works, no errors.
In the main loop (which is just a standard event loop waiting for SDL_QUIT, keystrokes and a user-event which a SDL_Timer puts in the event queue every second) I just do (for the timer triggered event):
idx = (idx+1) % 3; // idx is global var initially 0.
SDL_RenderClear(myrenderer);
SDL_RenderCopy(myrenderer, myarray[idx], NULL, NULL);
SDL_RendererPresent(myrenderer);
This works fine for 0.bmp and 1.bmp, but the 3rd image (2.bmp) simply shows as a black field.
This is structural.
If I alternate the first 2 images they are both fine.
If I alternate the 2nd and 3rd image the 3rd image doesn't show.
If I use more than 3 images then 3 and upwards show as black.
Loading order doesn't matter. It starts going wrong with the 3rd image loaded from disk.
All images are properly formatted BMP's.
I even saved 2.bmp back to disk under a different name by using SDL_SaveBMP() after it was loaded to make sure it got loaded in memory OK. The new file is bit for bit identical to the original.
This program, without modifications and the same bmp files, works fine on OSX (XCode5) and Windows (VC++ 2012 Express).
The problem only shows on the Raspberry PI.
I have placed explicit error checks on every call that can leave a result/error-code (not shown in the samples above for brevity) but all of them show "no error".
I have used the latest stable source set of www.libsdl.org and compiled as instructed (configure, make, make install, etc.).
Anybody got any idea what could be going on ?
P.S.
Keyboard input doesn't seem to work either on my PI, but I haven't delved into that yet.
Answering myself as I finally figured it out myself...
I finally went back to the README-raspberrypi.txt that came with the SDL2 sources.
I didn't read it carefully enough the first time around...
Problem 1: I'am running on a FULL-HD display. The PI's default GPU memory is 64MB which is not enough for large displays and double-buffering. As suggested in the README I increased this to 128MB and this solved the black image problem.
Problem 2: Text input wasn't working because my user-account was not in the input group. I had added the default "pi" account to the input group initially, but when I later started using another account I forgot to add that user to the group.
In short: Caught by my own (too) quick skimming of the documentation.
I am new to c++ programming , today i was trying to save an image using CImg .
CImg is C++ Template Image Processing Library .
The basic code i wrote is(Please forgive any syntax erros , as copied part of my codes) :
#include "CImg.h"// Include CImg library header.
#include <iostream>
using namespace cimg_library;
using namespace std;
const int screen_size = 800;
//-------------------------------------------------------------------------------
// Main procedure
//-------------------------------------------------------------------------------
int main()
{
CImg<unsigned char> img(screen_size,screen_size,1,3,20);
CImgDisplay disp(img, "CImg Tutorial");
//Some drawing using img.draw_circle( 10, 10, 60, RED);
img.save("result.jpg"); // save the image
return 0;
}
But I cannot run my program as it says :
Invalid Parameter - 100%
'gm.exe' is not recognized as an internal or external command,
operable program or batch file.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
[CImg] *** CImgIOException *** [instance(800,800,1,3,02150020,non-shared)] CImg<unsigned char>::save_other() : Failed to save file 'result.jpg'. Format is not natively supported, and no external commands succeeded.
terminate called after throwing an instance of 'cimg_library::CImgIOException'
what(): [instance(800,800,1,3,02150020,non-shared)] CImg<unsigned char>::save_other() : Failed to save file 'result.jpg'. Format is not natively supported, and no external commands succeeded.
Though i can see the image , I cannot save it.
After googling a bit i found people saying to install ImageMagick , i have installed it but no help .
Some of the Forum says to compile against libjpeg, libpng, libmagick++. But i don't know how to compile against those libraries.
I am using Eclipse CDT plugin to write C++ project .
Please help me .
I had the same error, and installing of GraphicsMagick (not ImageMagick) helped me.
I've downloaded and installed GraphicsMagick-1.3.26-Q8-win64-dll.exe from ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/. You may choose another one, if you need:
Note that the QuantumDepth=8 version (Q8) which provides industry
standard 24/32 bit pixels consumes half the memory and about 30% less
CPU than the QuantumDepth=16 version (Q16) which provides 48/64 bit
pixels for high-resolution color. A Q8 version is fine for processing
typical photos intended for viewing on a computer screen. If you are
dealing with film, scientific, or medical images, use ICC color
profiles, or deal with images that have limited contrast, then the Q16
version is recommended.
Important: during installation, don't remove checkbox "Update executable search path", which updates environment variable %PATH%, making gm.exe available from any place.
In my case, it was also required to install Ghostscript - which is highly recommended to install by GraphicsMagick. There is a link to x64 Ghostscript: https://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/9.09/gs909w64.exe/download (I've put it here, because links from the GraphicMagick websites leads you to 32-bit only).
After that, it worked fine for me.
For some image formats (as .jpg, .png, .tif and basically all formats that require data compression), CImg will try to use an external tool to save them (such as convert from ImageMagick or gm from GraphicsMagick).
If you don't have any installed, then you won't be able to save .jpg files without having to link your code with the libjpeg library, to get a native support for JPEG read/write (then, you'll need to #define cimg_use_jpeg before #include "CImg.h", to tell the library you want to use the libjpeg features).
If you want to keep things simpler, I'd recommend to save your image using another (non-compressed) image format, as .bmp or .ppm.
These formats are handled natively by CImg and do not require to link with external libraries.
I know this question is old, but I kept getting the same error on one project and not on another and this is the only thing on Google.
To get rid of it, you must do 2 things:
Install dynamic ImageMagick libraries for your appropriate OS and architecture(32/64). Link
I was using VisualStudio, and the character set must be set to "Unicode". The error would appear again when I reverted back to Multi-Byte character set. I guess this has something to do with the way CImg handles strings and miscompares them.
I'm trying to adapt a code in order to add a sound capture feature (on a live stream), with the help of ffmpeg and directshow.
When i try to play with ffplay the AVIsynth file, everything works perfectly i've got the audio and video. But when i open this input file by code i only find the video stream.
The Avs file :
V = DirectShowSource("Decklink_HDMI.grf", fps=10, framecount=1000000000, seek=false, audio=false)
A = DirectShowSource("Decklink_Audio.grf", fps=1, framecount=1000000000, video=false)
AudioDub(V, A)
The opening code :
ffmpeg::AVInputFormat * ifmt;
ifmt = ffmpeg::av_find_input_format("avs");
// Open input file
if(ffmpeg::avformat_open_input(&pFormatCtx, filename.toStdString().c_str(), ifmt, NULL) != 0)
When i make a variable lookout on gdb just after the opening.
i'm looking at nb_streams in pFormatCtx->nb_streams and it's at 1
The only stream i can find in pFormatCtx->stream is a video one. And that's why i'm not able to capture the sound.
So i'm asking if i'm doing something wrong with my opening or if i miss something.
Ps : I know the code shown is short but the problem appears at this very step !
Thank you
Kurt
-- EDIT --
I've also noticed that when I dump the AVFormatContext the video stream got a 456x32 size.
And i can find this very same size of the window displayed when i try to launch a corrupted script with ffplay.
The original video format when i play the correct script with ffplay is of 1920x1080
I think my problem is maybe deeper than the simple fact of not being able to get the audio stream.
I'm trying to find out how to know the error message that is displayed on this 456x32 windows
-- EDIT2 --
I Find out what is written on this image and my problem is solved, badly placed avs script an old one was is place.
I'm ashamed.
My bad,
A badly placed avs file was my problem.
Anyway ffmpeg is a bit painful in his way of showing error, being forced to make a snapshot without any error msg or exception raised (or maybe did i failled).