Skip to content

Commit

Permalink
Merge branch 'emgucv_5.3.0' into emgucv_5.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
emgucv committed Aug 22, 2023
2 parents 489f101 + 688bb0a commit a339e91
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,25 @@ static void addAvailableLanguages(const std::string &datadir, const std::string
const size_t extlen = sizeof(kTrainedDataSuffix);
#ifdef _WIN32
WIN32_FIND_DATA data;
#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) /* windows but not desktop environment */
const int strBufferSize = 4096;
wchar_t w_string[strBufferSize];
MultiByteToWideChar(CP_ACP, 0, (datadir + base2 + "*").c_str(), -1, w_string, strBufferSize);
HANDLE handle = FindFirstFile(w_string, &data);
#else
HANDLE handle = FindFirstFile((datadir + base2 + "*").c_str(), &data);
#endif
if (handle != INVALID_HANDLE_VALUE) {
BOOL result = TRUE;
for (; result;) {
#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) /* windows but not desktop environment */
char cstr[strBufferSize];
size_t charsConverted;
wcstombs_s(&charsConverted, cstr, data.cFileName, wcslen(data.cFileName));
char *name = cstr;
#else
char *name = data.cFileName;
#endif
// Skip '.', '..', and hidden files
if (name[0] != '.') {
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) {
Expand Down Expand Up @@ -1031,6 +1045,8 @@ bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data, size_t size, co
const char *retry_config, int timeout_millisec,
TessResultRenderer *renderer,
int tessedit_page_number) {
return false;
/*
Pix *pix = nullptr;
int page = (tessedit_page_number >= 0) ? tessedit_page_number : 0;
size_t offset = 0;
Expand Down Expand Up @@ -1064,6 +1080,7 @@ bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data, size_t size, co
}
}
return true;
*/
}

// Master ProcessPages calls ProcessPagesInternal and then does any post-
Expand Down
4 changes: 4 additions & 0 deletions src/arch/simddetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
# elif defined(HAVE_ELF_AUX_INFO)
# include <sys/auxv.h>
# include <sys/elf.h>
# elif defined(__APPLE__)
# else
# endif
#endif

Expand Down Expand Up @@ -228,6 +230,8 @@ SIMDDetect::SIMDDetect() {
unsigned long hwcap = 0;
elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap);
neon_available_ = hwcap & HWCAP_NEON;
# elif defined(__APPLE__)
neon_available_ = false;
# endif
#endif

Expand Down
7 changes: 7 additions & 0 deletions src/ccutil/ccutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,14 @@ void CCUtil::main_setup(const std::string &argv0, const std::string &basename) {
} else if (datadir.empty() || _access(datadir.c_str(), 0) != 0) {
/* Look for tessdata in directory of executable. */
char path[_MAX_PATH];
#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) /* windows but not desktop environment */
wchar_t w_string[_MAX_PATH];
DWORD length = GetModuleFileName(nullptr, w_string, sizeof(path));
size_t charsConverted;
wcstombs_s(&charsConverted, path, _MAX_PATH, w_string, _MAX_PATH);
#else
DWORD length = GetModuleFileName(nullptr, path, sizeof(path));
#endif
if (length > 0 && length < sizeof(path)) {
char *separator = std::strrchr(path, '\\');
if (separator != nullptr) {
Expand Down
8 changes: 7 additions & 1 deletion src/ccutil/scanutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

#include "scanutils.h"

// workaround for "'off_t' was not declared in this scope" with -std=c++11
// OSX has off_t defined, but HAVE_OFF_T is false...
#if !defined(HAVE_OFF_T) && !__APPLE__ && !defined(__EMSCRIPTEN_major__)
typedef long off_t;
#endif // off_t

enum Flags {
FL_SPLAT = 0x01, // Drop the value, do not assign
FL_INV = 0x02, // Character-set with inverse
Expand Down Expand Up @@ -134,7 +140,7 @@ static uintmax_t streamtoumax(FILE *s, int base) {
}

ungetc(c, s);
return minus ? -v : v;
return minus ? 0 : v;
}

static double streamtofloat(FILE *s) {
Expand Down
2 changes: 1 addition & 1 deletion src/lstm/stridemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class StrideMap {
// Default copy constructor and operator= are OK to use here!

// Sets up the stride for the given array of height, width pairs.
void SetStride(const std::vector<std::pair<int, int>> &h_w_pairs);
void SetStride(const std::vector< std::pair<int, int> >& h_w_pairs);
// Scales width and height dimensions by the given factors.
void ScaleXY(int x_factor, int y_factor);
// Reduces width to 1, across the batch, whatever the input size.
Expand Down

0 comments on commit a339e91

Please sign in to comment.