Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, May 11, 2008 11:08:08 AM(UTC)

alir  
alir

Groups: Registered
Posts: 3


The code that I'm posting worked fine with v13 but it fails with V15 eval.

The call to L_DocAddPage returns ERROR_DOC_INV_IMAGE_RESOLUTION.


CDC *pDC = GetDC();


CDC MemDC;
MemDC.CreateCompatibleDC(pDC);


CBitmap Bmp;
Bmp.CreateCompatibleBitmap(pDC,m_Capture.Width(),m_Capture.Height());

CBitmap *pOldBmp = MemDC.SelectObject(&Bmp);

CDC *pDeskDC = GetDesktopWindow()->GetDC();

MemDC.BitBlt(0,0,m_Capture.Width(),m_Capture.Height(),pDeskDC,m_Capture.left,m_Capture.top,SRCCOPY);

GetDesktopWindow()->ReleaseDC(pDeskDC);

L_INT Ret;


L_InitBitmap(&BmpHandle, sizeof(BITMAPHANDLE), 0, 0, 0);
L_ChangeFromDDB(MemDC.GetSafeHdc(),&BmpHandle,sizeof(BITMAPHANDLE),(HBITMAP)Bmp.GetSafeHandle(),NULL);
if (!m_Palm || m_Pocket)
{
Ret = L_ColorResBitmap(&BmpHandle,&BmpHandle,sizeof(BITMAPHANDLE),1,CRF_OPTIMIZEDPALETTE,NULL,NULL,0,NULL,NULL);
}
if (!m_Pocket)
{
for (int i = 0; i GetSafeHdc(), /* Device context */
&BmpHandle,/* Bitmap handle */
NULL, /* Default source rectangle */
NULL, /* Default source clip area */
&MyRect, /* Destination rectangle */
NULL, /* Default destination clipping rectangle */
SRCCOPY); /* ROP3 code for a Normal Paint */

ReleaseDC(pDC);

Ret = L_DocAddPage(hDoc,&BmpHandle,0);

LANGIDS * pLangIds = NULL;
L_INT nLangCount = 0;
RECOGNIZEOPTS RecogOpts;
RECOGMODULE_TRADEOFF TradeOff;

L_INT nRet = L_DocGetDefaultSpellLanguages (hDoc, &pLangIds, &nLangCount);
if (nRet == SUCCESS)
{
nRet = L_DocGetRecognizeModuleTradeOff(hDoc, &TradeOff);
if (TradeOff != RECGMD_ACCURATE)
nRet = L_DocSetRecognizeModuleTradeOff(hDoc, RECGMD_BALANCED);
HANDPRINTOPTIONS HOptions;
HOptions.uStructSize = sizeof(HANDPRINTOPTIONS);
HOptions.bSpace = FALSE;
HOptions.nCharHeight = HOptions.nCharSpace = HOptions.nCharWidth = 0;
HOptions.style = HAND_STYLE_US;
L_DocSetHandPrintOptions(hDoc,&HOptions);

RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
RecogOpts.nPageIndexStart = 0;
RecogOpts.nPagesCount = 1;
RecogOpts.bEnableSubSystem = TRUE;
RecogOpts.bEnableCorrection = TRUE;
RecogOpts.SpellLangId = LANG_ID_NO;
RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

// nRet = L_DocRecognize(hDoc, &RecogOpts, NULL, NULL);
nRet = L_DocRecognize(hDoc, &RecogOpts, NULL, NULL);
RECOGCHARS *pRecChar;
L_INT32 Count;
nRet = L_DocGetRecognizedCharacters(hDoc,0,&pRecChar,&Count,sizeof(RECOGCHARS));
TRACE1("Count %d\n",Count);
m_LettersCtrl.SetWindowText(m_Letters);
if (Count < 6)
{
continue;
}
for (int i = 0; i < Count;i++)
{
m_Letters += CString(pRecChar[i].wGuessCode);
if (m_Letters[i] == '0')
{
m_Letters.SetAt(i,'O');
}
if (m_Letters[i] == '1')
{
m_Letters.SetAt(i,'I');
}
}
L_DocFreeRecognizedCharacters(hDoc,&pRecChar);
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, May 12, 2008 5:42:19 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)






It seems
you're feeding images to the OCR engine that you draw on using Windows functions (some sort of screen capture).

In all
cases, when you give a bitmap to the OCR engine using L_DocAddPage, it should
have an appropriate value in the XResolution and YResolution members of the BITMAPHANDLE
structure. If these members have too low or too high values, try to change them to something between 150 and 300.

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.059 seconds.