tesseract how to find the blob - tesseract

I'd like to use tesseract-ocr making newspaper's page layout analysis, in order to find the blobs(titles, paragraphs) on iOS platform. I don't know how to achieve it and how to use the tesseract API.There are some mistakes:
tesseract::PageIterator *pageIterator = tesseract->AnalyseLayout();
error : Member access into incomplete type 'tesseract::PageIterator'
tesseract::PageIteratorLevel * level = pageIterator->level();
int *left; int *top; int *right; int *bottom;
pageIterator->BoundingBox(level,left,top,right,bottom);
error : Member access into incomplete type 'tesseract::PageIterator'
I need your advice. Thank you!

The code is going to be similar to Tess4J: How to use ResultIterator?, but at RIL_PARA or RIL_BLOCK level.

Related

error: field ‘parent_instance’ has incomplete type GtkLabel parent_instance;

Problem:
I want to make a Gtk.Label child but it seems I cannot make a child of that type. I checked here to find a possible fix, but I cannot get my head around it. What should I do in my case to fix that problem. I basically only want a button with an extra property. Thanks you!
Error:
error: field ‘parent_instance’ has incomplete type
64 | GtkLabel parent_instance;
error: unknown type name ‘GtkLabelClass’
69 | GtkLabelClass parent_class;
Snippet:
namespace Redacted {
public class StyleLabel : Gtk.Widget {
public StyleLabel(Redacted.Preferences.Styles style) {
Object (label: style.ToString ());
this.style = style;
}
public Redacted.Preferences.Styles style { get; set; }
}
}
A lot of widgets in GTK4 have been marked as "final", which means you can't actually derive a subclass from them anymore. You can also see this in the original GtkLabel documentation, where it mentions "final class Gtk.Label".
GTK4 prefers composition over inheritance (for several reasons) so when you're writing a UI and you write a custom widget, the way to do this in GTK 4 is to put a Gtk.Label inside your widget (using Gtk.Widget.set_parent()). You can find some more explanation and an example at this topic in the GNOME discourse forum.
(as a side note: technically, you could also write your own version of Gtk.Label, but that would be a lot of work for very little gain)

FSharpLint, how to use the rule "InterfaceNamesMustBeginWithI" in SuppressMessageAttribute?

[<SuppressMessage("NameConventions","InterfaceNamesMustBeginWithI")>] //No effect
[<SuppressMessage("NameConventions","InterfaceNames")>] //It's working
module Test=
type [<AllowNullLiteral>] MutationEvent =
abstract attrChange: float with get, set
...
Also, failed to search source code about "InterfaceNamesMustBeginWithI".
The name of the rule is InterfaceNames, so you can suppress it thus:
[<SuppressMessage("","InterfaceNames")>]
module Test =
...
Also note that the first argument to SuppressMessage is not used by fsharplint, so it can be anything (although not null, strangely enough!)
There are pointers to InterfaceNamesMustBeginWithI in the documentation, but this is not correct.

How to add write_raw function in my iio_info structure

I am writing a driver using iio framework. So far it goes well. All the inputs and sysfs entries are working perfectly and the values measured are fine. (It is very well documented and it is easy). But I need a small extension to be able to write on one of the channels. When I add my function in iio_info the compiler issues me an error:
drivers/iio/adc/iio-ccuss.c:197:15: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.write_raw = ccuss_iio_write_raw,
^~~~~~~~~~~~~~~~~~~
It is very weird for me. I even can't believe I am asking shamelessly this here but I am very frustrated. I lost almost half day with that.
My structure is:
static const struct iio_info ccuss_iio_info = {
.driver_module = THIS_MODULE,
.attrs = &ccuss_iio_attribute_group,
.read_raw = ccuss_iio_read_raw,
.write_raw = ccuss_iio_write_raw,
};
my channel types are IIO_VOLTAGE, IIO_TEMP and IIO_HUMIDITYRELATIVE.
I am start thinking to make it as an device attribute :-( if I do not receive an answer in the next 12 hours.
Update:
just to be more visible, according Murphy's comment.
static int ccuss_iio_write_raw(struct iio_dev *iio,
struct iio_chan_spec const *channel, int *val1,
int *val2, long mask);
P.S. I do not want to remove this error by the most known way. The QA (and me) will be unhappy.
Thanks
According to the reference the write_raw() function is declared as follows:
int (*write_raw)(
struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val,
int val2,
long mask);
Your implementation is declared like this:
static int ccuss_iio_write_raw(
struct iio_dev *iio,
struct iio_chan_spec const *channel,
int *val1,
int *val2,
long mask);
So you declare the two integer parameters as pointers, but they are expected to be passed by value. I think that's the mismatch that causes the "incompatible pointer type" error.

libspotify sp_search_type

When executing sp_search_create, there is a parameter for sp_search_type which is defined
typedef enum sp_search_type {
SP_SEARCH_STANDARD = 0,
SP_SEARCH_SUGGEST = 1,
} sp_search_type;
I don't see any change in the result. Is there a suggested way to handle this differently from a normal search ? For instance if we are implementing auto complete or am I missing something here.
Thanks,

UIA: Get ControlType from control type name (string)

Using Microsoft UI Automation. I have a string which represents UIA control type, like "Window" or "Button". I would like to get a ControlType object which fits this string. How to do it? Is some enumerations exists which represents all the UIA control types? I found only that ControlType has ControlType.LookupById(int) method. But I have to know correspondence between ID and name. Of course, I can create my own switch with all the possible UIA control types, or even use reflection to get all the members of ControlType factory. But I'm sure should be easier way..
I've found such way, using PresentationCore.dll, very strange for me, that such enum doesn't exist in standart UIA DLL. Also please pay attention, that there is a bug in ControlType class, I guess due to its private static constructor. If you call ControlType.LookupById(enumId) 1st time, it will return null, but in the 2nd time will be OK. The solution is quite simple -- just call ToString before usage, it will initialize the static constructor :)
using System.Windows.Automation.Peers;
// solving the bug with static constructor of ControlType..
ControlType.Button.ToString();
string controlTypeString = "Window";
AutomationControlType typeEnum;
bool result = Enum.TryParse(controlTypeString, true, out typeEnum);
if (result) typeEnum = (AutomationControlType)Enum.Parse(typeof(AutomationControlType), controlTypeString);
int enumId = (int)typeEnum + 50000;
ControlType controlType = ControlType.LookupById(enumId);