XCB Pointer Coordinates are Stuck at (0,0) - x11

I have implemented a Wayland compositor (via wlroots) in a game engine that is equipped with XWayland/XCB support for X apps. When I launch xev, it seems to receive ButtonNotify events just fine (so I can type just fine in windows). It also receives MotionNotify events every frame, but the problem is that its coordinates are stuck at the origin!
# This repeats every frame when I mouse over windows:
MotionNotify event, serial 32, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1275037533, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES
Note that:
My game engine handles all of the cursor stuff, so I omit explicitly creating a cursor through XCB/XWayland (though have tried to add one, and it doesn't seem to fix the coordinate issue).
I've tried sending hard coded coordinates to my window to no avail. Nothing seems to update its X coordinates (I've tried through xwayland facilities as well as through direct xcb_warp_pointer calls).
I have verified via the WAYLAND_DEBUG=server flag that the coordinates are successfully being sent over the wayland wire with the proper coordinates every frame in between frame calls.
I know that abstracted of all other details it is very hard to debug this problem, but what I am curious about is if there is some well-known thing that needs to get initialized before pointer events can be updated. Because my compositor is so stripped down (the game engine handling most things), is there something that I need to get pointer updates working that I don't realize I need?
To make my question more concrete: What state must be initialized in XCB before pointer motion can be something besides (0,0)?
EDIT: Here is some xev log data to see what state I might be missing:
$ DISPLAY=:2 xev & # `DISPLAY=:2` is where XWayland is located
[1] 26726
Outer window is 0x400001, inner window is 0x400002
PropertyNotify event, serial 8, synthetic NO, window 0x400001,
atom 0x27 (WM_NAME), time 1549489650, state PropertyNewValue
PropertyNotify event, serial 9, synthetic NO, window 0x400001,
atom 0x22 (WM_COMMAND), time 1549489650, state PropertyNewValue
PropertyNotify event, serial 10, synthetic NO, window 0x400001,
atom 0x28 (WM_NORMAL_HINTS), time 1549489650, state PropertyNewValue
CreateNotify event, serial 11, synthetic NO, window 0x400001,
parent 0x400001, window 0x400002, (10,10), width 50, height 50
border_width 4, override NO
PropertyNotify event, serial 14, synthetic NO, window 0x400001,
atom 0xf7 (WM_PROTOCOLS), time 1549489650, state PropertyNewValue
MapNotify event, serial 15, synthetic NO, window 0x400001,
event 0x400001, window 0x400002, override NO
ClientMessage event, serial 28, synthetic YES, window 0x400001,
message_type 0xf7 (WM_PROTOCOLS), format 32, message 0x10a (_NET_WM_PING)
PropertyNotify event, serial 29, synthetic NO, window 0x400001,
atom 0x10b (WM_STATE), time 1549489661, state PropertyNewValue
PropertyNotify event, serial 29, synthetic NO, window 0x400001,
atom 0x100 (_NET_WM_STATE), time 1549489661, state PropertyNewValue
MapNotify event, serial 29, synthetic NO, window 0x400001,
event 0x400001, window 0x400001, override NO
VisibilityNotify event, serial 29, synthetic NO, window 0x400001,
state VisibilityUnobscured
Expose event, serial 29, synthetic NO, window 0x400001,
(0,0), width 178, height 10, count 3
Expose event, serial 29, synthetic NO, window 0x400001,
(0,10), width 10, height 58, count 2
Expose event, serial 29, synthetic NO, window 0x400001,
(68,10), width 110, height 58, count 1
Expose event, serial 29, synthetic NO, window 0x400001,
(0,68), width 178, height 110, count 0
EnterNotify event, serial 29, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549489662, (-2,-2), root:(0,0),
mode NotifyNormal, detail NotifyAncestor, same_screen YES,
focus YES, state 0
KeymapNotify event, serial 29, synthetic NO, window 0x0,
keys: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MotionNotify event, serial 31, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549495244, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 31, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549495260, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 31, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549495260, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 31, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549495277, (-2,-2), root:(0,0),
state 0x0, is_hint 0, same_screen YES
#...
This can be compared to a properly running rootston (wlroot's sample compositor) running xev:
$ Outer window is 0x400001, inner window is 0x400002
MappingNotify event, serial 0, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
MappingNotify event, serial 0, synthetic NO, window 0x0,
request MappingModifier, first_keycode 0, count 0
PropertyNotify event, serial 8, synthetic NO, window 0x400001,
atom 0x27 (WM_NAME), time 1549619590, state PropertyNewValue
PropertyNotify event, serial 9, synthetic NO, window 0x400001,
atom 0x22 (WM_COMMAND), time 1549619590, state PropertyNewValue
PropertyNotify event, serial 10, synthetic NO, window 0x400001,
atom 0x28 (WM_NORMAL_HINTS), time 1549619590, state PropertyNewValue
CreateNotify event, serial 11, synthetic NO, window 0x400001,
parent 0x400001, window 0x400002, (10,10), width 50, height 50
border_width 4, override NO
PropertyNotify event, serial 14, synthetic NO, window 0x400001,
atom 0xf7 (WM_PROTOCOLS), time 1549619590, state PropertyNewValue
MapNotify event, serial 15, synthetic NO, window 0x400001,
event 0x400001, window 0x400002, override NO
PropertyNotify event, serial 29, synthetic NO, window 0x400001,
atom 0x10b (WM_STATE), time 1549619590, state PropertyNewValue
PropertyNotify event, serial 29, synthetic NO, window 0x400001,
atom 0x100 (_NET_WM_STATE), time 1549619590, state PropertyNewValue
MapNotify event, serial 29, synthetic NO, window 0x400001,
event 0x400001, window 0x400001, override NO
VisibilityNotify event, serial 29, synthetic NO, window 0x400001,
state VisibilityUnobscured
Expose event, serial 29, synthetic NO, window 0x400001,
(0,0), width 178, height 10, count 3
Expose event, serial 29, synthetic NO, window 0x400001,
(0,10), width 10, height 58, count 2
Expose event, serial 29, synthetic NO, window 0x400001,
(68,10), width 110, height 58, count 1
Expose event, serial 29, synthetic NO, window 0x400001,
(0,68), width 178, height 110, count 0
EnterNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638410, (153,0), root:(155,2),
mode NotifyNormal, detail NotifyAncestor, same_screen YES,
focus YES, state 0
KeymapNotify event, serial 34, synthetic NO, window 0x0,
keys: 68 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MotionNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638410, (153,0), root:(155,2),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638417, (154,4), root:(156,6),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638426, (155,9), root:(157,11),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638434, (157,13), root:(159,15),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638442, (161,18), root:(163,20),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638450, (165,25), root:(167,27),
state 0x0, is_hint 0, same_screen YES
MotionNotify event, serial 34, synthetic NO, window 0x400001,
root 0x29c, subw 0x0, time 1549638458, (172,30), root:(174,32),
state 0x0, is_hint 0, same_screen YES

The issue was that the XWayland's screen had a width_in_pixels == height_in_pixels == 0. This was forcing all pointer motion to (0,0). Forcing the screen's initialization area to be positive fixed this issue.

I can't say I know my way around this (and I do not think this is an xcb question), but which functions in wlroots do you call to move the cursor?
For example, I took a quick look at the wlroots multi-pointer example and found this:
static void handle_cursor_motion(struct wl_listener *listener, void *data) {
struct sample_cursor *cursor =
wl_container_of(listener, cursor, cursor_motion);
struct wlr_event_pointer_motion *event = data;
wlr_cursor_move(cursor->cursor, event->device, event->delta_x,
event->delta_y);
}
static void handle_cursor_motion_absolute(struct wl_listener *listener,
void *data) {
struct sample_cursor *cursor =
wl_container_of(listener, cursor, cursor_motion_absolute);
struct wlr_event_pointer_motion_absolute *event = data;
wlr_cursor_warp_absolute(cursor->cursor, event->device, event->x, event->y);
}
So, I'd say that it is your code that provides the cursor positions to wlroots.

Related

SetWindowPos behaviour for Notepad.exe on multi-moniter setup

I am trying to move the Notepad window using the SetWindowPos() Win32 API.
When I pass x/left = -1, instead of only moving the window in x-direction, it also changes the y/top of the window (window sort of creeps upward). This only happens in a multi-monitor setup.
x=0 multi-monitor:
x=-1 multi-monitor:
In a single monitor setup, it is moving the window in the x-direction as expected:
x=-1 single-monitor:
Also, I created my own simple window (using Visual Studio's wizard-generated code) and it works as expected (y/top did not change) even in a multi-monitor setup.
x=0 multi-monitor:
x=-1 multi-monitor:
I observed the same behaviour in Chrome/Brave/MSEdge windows as well in a multi-monitor setup.
I tried to install WH_CALLWNDPROC and WH_GETMESSAGE hooks, and used Spy++, but I didn't get any useful information about what is happening.
TEST:
Make sure notepad.exe is running.
For simplicity, I will use Python and will require win32gui and win32con
pip install pywin32
import win32gui
import win32con
notepadHwnd = win32gui.FindWindow("Notepad", None)
// => x = 0
win32gui.SetWindowPos(notepadHwnd, win32con.HWND_TOP, 0, 200, 200, 100, win32con.SWP_NOREDRAW)
win32gui.GetWindowRect(notepadHwnd)
// (0, 200, 200, 300)
// => x = -1
win32gui.SetWindowPos(notepadHwnd, win32con.HWND_TOP, -1, 200, 200, 100, win32con.SWP_NOREDRAW)
win32gui.GetWindowRect(notepadHwnd)
// (-1, 160, 199, 300) 160??????????????
Is this behaviour implementation-specific? Any explanation as to why this is the case?
Both of the monitors are 1920x1080.
Update:
The y/top parameters effects how much y/top itself gets changed when x=-1 is specified e.g.
when y=0, then change in y'=0
>>> win32gui.SetWindowPos(notepadHwnd, win32con.HWND_TOP, -1, 0, 200, 100, win32con.SWP_SHOWWINDOW)
>>> win32gui.GetWindowRect(notepadHwnd)
(-1, 0, 199, 100)
when y=60, then change in y'=48
>>> win32gui.SetWindowPos(notepadHwnd, win32con.HWND_TOP, -1, 60, 200, 100, win32con.SWP_SHOWWINDOW)
>>> win32gui.GetWindowRect(notepadHwnd)
(-1, 48, 199, 160)
when y=600, then change in y'=480
>>> win32gui.SetWindowPos(notepadHwnd, win32con.HWND_TOP, -1, 600, 200, 100, win32con.SWP_SHOWWINDOW)
>>> win32gui.GetWindowRect(notepadHwnd)
(-1, 480, 199, 700)

Driving a 137,930 KHz 1080x1920 portrait HDMI screen from an IMX8M

I need to make a fixed-frequency screen (with a new custom mode line):
{ DRM_MODE("1080x1920", DRM_MODE_TYPE_DRIVER, 137930,
1080, 1140, 1150, 1185, 0,
1920, 1928, 1932, 1940, 0,
DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
.vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, },
(in edid_cea_modes[] in imx-hdp.c) work with the iMX8M.
My problem is that there is no 137,930 KHz mode in
/* Table 8. HDMI TX clock control settings (pixel clock is output) */
const u32 t28hpc_hdmitx_clock_control_table_pixel_out[T28HPC_HDMITX_CLOCK_CONTROL_TABLE_ROWS_PIXEL_OUT][T28HPC_HDMITX_CLOCK_CONTROL_TABLE_COLS_PIXEL_OUT] = {
{ 27000, 1000, 270000, 0x03, 0x1, 0x1, 240, 0x0BC, 0x030, 80, 0x026, 0x026, 2160000, 0, 2, 2, 2, 4, 135000, 0x3, 27000, 1},
{ 27000, 1250, 337500, 0x03, 0x1, 0x1, 300, 0x0EC, 0x03C, 100, 0x030, 0x030, 2700000, 0, 2, 2, 2, 4, 168750, 0x3, 33750, 1},
{ 27000, 1500, 405000, 0x03, 0x1, 0x1, 360, 0x11C, 0x048, 120, 0x03A, 0x03A, 3240000, 0, 2, 2, 2, 4, 202500, 0x3, 40500, 1},
{ 27000, 2000, 540000, 0x03, 0x1, 0x1, 240, 0x0BC, 0x030, 80, 0x026, 0x026, 2160000, 0, 2, 2, 2, 4, 270000, 0x2, 54000, 1},
{ 54000, 1000, 540000, 0x03, 0x1, 0x1, 480, 0x17C, 0x060, 80, 0x026, 0x026, 4320000, 1, 2, 2, 2, 4, 270000, 0x3, 54000, 1},
{ 54000, 1250, 675000, 0x04, 0x1, 0x1, 400, 0x13C, 0x050, 50, 0x017, 0x017, 2700000, 0, 1, 1, 2, 4, 337500, 0x2, 67500, 1},
{ 54000, 1500, 810000, 0x04, 0x1, 0x1, 480, 0x17C, 0x060, 60, 0x01C, 0x01C, 3240000, 0, 2, 2, 2, 2, 405000, 0x2, 81000, 1},
{ 54000, 2000, 1080000, 0x03, 0x1, 0x1, 240, 0x0BC, 0x030, 40, 0x012, 0x012, 2160000, 0, 2, 2, 2, 1, 540000, 0x1, 108000, 1},
{ 74250, 1000, 742500, 0x03, 0x1, 0x1, 660, 0x20C, 0x084, 80, 0x026, 0x026, 5940000, 1, 2, 2, 2, 4, 371250, 0x3, 74250, 1},
{ 74250, 1250, 928125, 0x04, 0x1, 0x1, 550, 0x1B4, 0x06E, 50, 0x017, 0x017, 3712500, 1, 1, 1, 2, 4, 464062, 0x2, 92812, 1},
{ 74250, 1500, 1113750, 0x04, 0x1, 0x1, 660, 0x20C, 0x084, 60, 0x01C, 0x01C, 4455000, 1, 2, 2, 2, 2, 556875, 0x2, 111375, 1},
{ 74250, 2000, 1485000, 0x03, 0x1, 0x1, 330, 0x104, 0x042, 40, 0x012, 0x012, 2970000, 0, 2, 2, 2, 1, 742500, 0x1, 148500, 1},
{ 99000, 1000, 990000, 0x03, 0x1, 0x1, 440, 0x15C, 0x058, 40, 0x012, 0x012, 3960000, 1, 2, 2, 2, 2, 495000, 0x2, 99000, 1},
{ 99000, 1250, 1237500, 0x03, 0x1, 0x1, 275, 0x0D8, 0x037, 25, 0x00B, 0x00A, 2475000, 0, 1, 1, 2, 2, 618750, 0x1, 123750, 1},
{ 99000, 1500, 1485000, 0x03, 0x1, 0x1, 330, 0x104, 0x042, 30, 0x00D, 0x00D, 2970000, 0, 2, 2, 2, 1, 742500, 0x1, 148500, 1},
{ 99000, 2000, 1980000, 0x03, 0x1, 0x1, 440, 0x15C, 0x058, 40, 0x012, 0x012, 3960000, 1, 2, 2, 2, 1, 990000, 0x1, 198000, 1},
{148500, 1000, 1485000, 0x03, 0x1, 0x1, 660, 0x20C, 0x084, 40, 0x012, 0x012, 5940000, 1, 2, 2, 2, 2, 742500, 0x2, 148500, 1},
{148500, 1250, 1856250, 0x04, 0x1, 0x1, 550, 0x1B4, 0x06E, 25, 0x00B, 0x00A, 3712500, 1, 1, 1, 2, 2, 928125, 0x1, 185625, 1},
{148500, 1500, 2227500, 0x03, 0x1, 0x1, 495, 0x188, 0x063, 30, 0x00D, 0x00D, 4455000, 1, 1, 1, 2, 2, 1113750, 0x1, 222750, 1},
{148500, 2000, 2970000, 0x03, 0x1, 0x1, 660, 0x20C, 0x084, 40, 0x012, 0x012, 5940000, 1, 2, 2, 2, 1, 1485000, 0x1, 297000, 1},
{198000, 1000, 1980000, 0x03, 0x1, 0x1, 220, 0x0AC, 0x02C, 10, 0x003, 0x003, 1980000, 0, 1, 1, 2, 1, 990000, 0x0, 198000, 1},
{198000, 1250, 2475000, 0x03, 0x1, 0x1, 550, 0x1B4, 0x06E, 25, 0x00B, 0x00A, 4950000, 1, 1, 1, 2, 2, 1237500, 0x1, 247500, 1},
{198000, 1500, 2970000, 0x03, 0x1, 0x1, 330, 0x104, 0x042, 15, 0x006, 0x005, 2970000, 0, 1, 1, 2, 1, 1485000, 0x0, 297000, 1},
{198000, 2000, 3960000, 0x03, 0x1, 0x1, 440, 0x15C, 0x058, 20, 0x008, 0x008, 3960000, 1, 1, 1, 2, 1, 1980000, 0x0, 396000, 1},
{297000, 1000, 2970000, 0x03, 0x1, 0x1, 330, 0x104, 0x042, 10, 0x003, 0x003, 2970000, 0, 1, 1, 2, 1, 1485000, 0x0, 297000, 1},
{297000, 1500, 4455000, 0x03, 0x1, 0x1, 495, 0x188, 0x063, 15, 0x006, 0x005, 4455000, 1, 1, 1, 2, 1, 2227500, 0x0, 445500, 1},
{297000, 2000, 5940000, 0x03, 0x1, 0x1, 660, 0x20C, 0x084, 20, 0x008, 0x008, 5940000, 1, 1, 1, 2, 1, 2970000, 0x0, 594000, 1},
{594000, 1000, 5940000, 0x03, 0x1, 0x1, 660, 0x20C, 0x084, 10, 0x003, 0x003, 5940000, 1, 1, 1, 2, 1, 2970000, 0x0, 594000, 1},
{594000, 750, 4455000, 0x03, 0x1, 0x1, 495, 0x188, 0x063, 10, 0x003, 0x003, 4455000, 1, 1, 1, 2, 1, 2227500, 0x0, 445500, 0},
{594000, 625, 3712500, 0x04, 0x1, 0x1, 550, 0x1B4, 0x06E, 10, 0x003, 0x003, 3712500, 1, 1, 1, 2, 1, 1856250, 0x0, 371250, 0},
{594000, 500, 2970000, 0x03, 0x1, 0x1, 660, 0x20C, 0x084, 10, 0x003, 0x003, 5940000, 1, 1, 1, 2, 2, 1485000, 0x1, 297000, 1},
in t28hpc_hdmitx_table.c.
I need to learn:
Is the table the full extent of what the GPU/DCSS can do? (In which case it can't drive my 1080x1920 portrait screen.)
If 137,930 KHz modes are physically possible in the DCSS, where do I get the other numbers from? (I assume that they're register settings.)
I've made this work.
The first step was to add a new row to t28hpc_hdmitx_clock_control_table_pixel_out[][] in drivers/gpu/drm/imx/hdp/t28hpc_hdmitx_table.c:
{138375, 1000, 1383750, 0x03, 0x1, 0x1, 615, 0x1E8, 0x07B, 40, 0x012, 0x012, 5535000, 1, 2, 2, 2, 2, 691875, 0x2, 138375, 1},
I generated these values with a day of staring at this table and finding patterns. Hint: one relation between fields involves a + 4 modification.
This still failed, but now with the error:
[ 2.147134] [drm] API_AFE_t28hpc_hdmitx.c:406 pixel_freq_khz: 138375, feedback_factor: 1000
[ 2.155556] [drm] API_AFE_t28hpc_hdmitx.c:409 Pixel clock frequency (138375 KHz) is supported in this color depth (8-bit). Settings found in row 16
[ 2.168785] [drm] VCO frequency is 5535000
[ 2.172900] [drm] API_AFE_t28hpc_hdmitx.c:499 VCO frequency (5535000 KHz) not supported
[ 2.180925] [drm:hdmi_phy_init_t28hpc] *ERROR* failed to set phy pclock
[ 2.187557] [drm:imx_hdp_imx_bind] *ERROR* Failed to initialise HDP PHY
I fixed this by the modifying a row in t28hpc_hdmitx_pll_tuning_table_pixel_out[][] from:
{11, 4950000, 4950000, 0x6, 0x3, 0x1, 0x00, 0x07, 550, 0x42, 213, 7, 258},
to
{11, 5535000, 5535000, 0x6, 0x3, 0x1, 0x00, 0x07, 615, 0x42, 213, 7, 258},
All that was required was to change instances of 4950000 to 5535000 and 550 to 615 to account for the frequency differences.
I've ended up with a screen that runs 0.3% too fast, due to there being no integer solutions which yield exactly 137,930 KHz, but that's better than a black screen.
With a few hour's additional work, I can probably tweak the porches to get 60Hz at a 138,375 KHz pixel clock.

How to read image description from the image with c++ or python?

I wish to read image description text from the image property tab (right click) with c++ or python.
Is there anyway to do it?
Looks like Opencv is not supporting it, I guess.
BTW, my OS is ubuntu 16.04.
Thanks,
If you are on Ubuntu, you probably have ImageMagick installed and that has a program called identify within the suite. You can just run the following in a Terminal at the command-line, or you could run a Python subprocess and grab its output:
identify -verbose someImage.jpg
Sample Output
Image: /Users/mark/Desktop/IMG_2326.JPG
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 3264x2448+0+0
Resolution: 72x72
Print size: 45.3333x34
Units: PixelsPerInch
Type: TrueColor
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Channel statistics:
Pixels: 7990272
Red:
min: 0 (0)
max: 255 (1)
mean: 139.125 (0.545587)
standard deviation: 62.0934 (0.243503)
kurtosis: -0.948773
skewness: -0.255567
entropy: 0.980761
Green:
min: 0 (0)
max: 255 (1)
mean: 129.827 (0.509124)
standard deviation: 63.4802 (0.248942)
kurtosis: -0.744472
skewness: -0.322559
entropy: 0.978628
Blue:
min: 0 (0)
max: 255 (1)
mean: 121.768 (0.477522)
standard deviation: 63.6425 (0.249578)
kurtosis: -1.14208
skewness: 0.0243162
entropy: 0.980614
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 130.24 (0.510744)
standard deviation: 63.4733 (0.248915)
kurtosis: -0.968273
skewness: -0.18575
entropy: 0.980001
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Matte color: grey74
Background color: white
Border color: srgb(223,223,223)
Transparent color: none
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 3264x2448+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 96
Orientation: TopLeft
Properties:
date:create: 2017-05-31T13:53:16+01:00
date:modify: 2014-09-23T08:22:25+01:00
exif:ApertureValue: 4845/1918
exif:BrightnessValue: 6155/1061
exif:ColorSpace: 1
exif:ComponentsConfiguration: 1, 2, 3, 0
exif:DateTime: 2014:09:23 08:22:25
exif:DateTimeDigitized: 2014:09:23 08:22:25
exif:DateTimeOriginal: 2014:09:23 08:22:25
exif:ExifImageLength: 2448
exif:ExifImageWidth: 3264
exif:ExifOffset: 204
exif:ExifVersion: 48, 50, 50, 49
exif:ExposureMode: 0
exif:ExposureProgram: 2
exif:ExposureTime: 1/120
exif:Flash: 24
exif:FlashPixVersion: 48, 49, 48, 48
exif:FNumber: 12/5
exif:FocalLength: 103/25
exif:FocalLengthIn35mmFilm: 33
exif:GPSAltitude: 10003/299
exif:GPSAltitudeRef: 0
exif:GPSInfo: 946
exif:GPSLatitude: 51/1, 51/1, 347/100
exif:GPSLatitudeRef: N
exif:GPSLongitude: 2/1, 12/1, 1992/100
exif:GPSLongitudeRef: W
exif:GPSTimeStamp: 7/1, 22/1, 2456/100
exif:ISOSpeedRatings: 64
exif:Make: Apple
exif:MakerNote: 65, 112, 112, 108, 101, 32, 105, 79, 83, 0, 0, 1, 77, 77, 0, 6, 0, 1, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 3, 0, 7, 0, 0, 0, 104, 0, 0, 0, 92, 0, 4, 0, 9, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, 0, 9, 0, 0, 0, 1, 0, 0, 0, 208, 0, 6, 0, 9, 0, 0, 0, 1, 0, 0, 0, 218, 0, 7, 0, 9, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 98, 112, 108, 105, 115, 116, 48, 48, 212, 1, 2, 3, 4, 5, 6, 7, 8, 89, 116, 105, 109, 101, 115, 99, 97, 108, 101, 85, 101, 112, 111, 99, 104, 85, 118, 97, 108, 117, 101, 85, 102, 108, 97, 103, 115, 18, 59, 154, 202, 0, 16, 0, 19, 0, 0, 18, 143, 64, 67, 109, 189, 16, 1, 8, 17, 27, 33, 39, 45, 50, 52, 61, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63
exif:MeteringMode: 5
exif:Model: iPhone 5
exif:Orientation: 1
exif:ResolutionUnit: 2
exif:SceneCaptureType: 0
exif:SceneType: 1
exif:SensingMethod: 2
exif:ShutterSpeedValue: 5567/806
exif:Software: 7.1.2
exif:SubjectArea: 1631, 1223, 1795, 1077
exif:SubSecTimeDigitized: 918
exif:SubSecTimeOriginal: 918
exif:thumbnail:Compression: 6
exif:thumbnail:JPEGInterchangeFormat: 1210
exif:thumbnail:JPEGInterchangeFormatLength: 12195
exif:thumbnail:ResolutionUnit: 2
exif:thumbnail:XResolution: 72/1
exif:thumbnail:YResolution: 72/1
exif:WhiteBalance: 0
exif:XResolution: 72/1
exif:YCbCrPositioning: 1
exif:YResolution: 72/1
jpeg:colorspace: 2
jpeg:sampling-factor: 2x2,1x1,1x1
signature: 84dc83ac4ff07920155036d321be9b8fe687be8b5eb68a76e20518b3e6f048f8
unknown: 103/25, 103/25, 12/5, 12/5
Profiles:
Profile-exif: 16380 bytes
Artifacts:
verbose: true
Tainted: False
Filesize: 3.9071MiB
Number pixels: 7.99027M
Pixels per second: 47.0016MB
User time: 0.150u
Elapsed time: 0:01.170
Version: ImageMagick 7.0.5-6 Q16 x86_64 2017-05-15 http://www.imagemagick.org
Another option is exiftool, which you run like this at the command-line, and which you could also run as a subprocess in Python:
exiftool ~/Desktop/IMG_2326.JPG
Sample Output
ExifTool Version Number : 10.50
File Name : IMG_2326.JPG
Directory : /Users/mark/Desktop
File Size : 3.9 MB
File Modification Date/Time : 2014:09:23 08:22:25+01:00
File Access Date/Time : 2017:05:31 13:57:20+01:00
File Inode Change Date/Time : 2017:05:31 13:53:16+01:00
File Permissions : rw-------
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Exif Byte Order : Big-endian (Motorola, MM)
Make : Apple
Camera Model Name : iPhone 5
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Software : 7.1.2
Modify Date : 2014:09:23 08:22:25
Y Cb Cr Positioning : Centered
Exposure Time : 1/120
F Number : 2.4
Exposure Program : Program AE
ISO : 64
Exif Version : 0221
Date/Time Original : 2014:09:23 08:22:25
Create Date : 2014:09:23 08:22:25
Components Configuration : Y, Cb, Cr, -
Shutter Speed Value : 1/120
Aperture Value : 2.4
Brightness Value : 5.801131008
Metering Mode : Multi-segment
Flash : Auto, Did not fire
Focal Length : 4.1 mm
Subject Area : 1631 1223 1795 1077
Run Time Scale : 1000000000
Run Time Epoch : 0
Run Time Value : 20406467784125
Run Time Flags : Valid
Sub Sec Time Original : 918
Sub Sec Time Digitized : 918
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 3264
Exif Image Height : 2448
Sensing Method : One-chip color area
Scene Type : Directly photographed
Exposure Mode : Auto
White Balance : Auto
Focal Length In 35mm Format : 33 mm
Scene Capture Type : Standard
Lens Info : 4.12mm f/2.4
Lens Make : Apple
Lens Model : iPhone 5 back camera 4.12mm f/2.4
GPS Latitude Ref : North
GPS Longitude Ref : West
GPS Altitude Ref : Above Sea Level
GPS Time Stamp : 07:22:24.56
Compression : JPEG (old-style)
Thumbnail Offset : 1222
Thumbnail Length : 12195
Image Width : 3264
Image Height : 2448
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2)
Aperture : 2.4
GPS Altitude : 33.4 m Above Sea Level
GPS Latitude : 51 deg 51' 3.47" N
GPS Longitude : 2 deg 12' 19.92" W
GPS Position : 51 deg 51' 3.47" N, 2 deg 12' 19.92" W
Image Size : 3264x2448
Megapixels : 8.0
Run Time Since Power Up : 5:40:06
Scale Factor To 35 mm Equivalent: 8.0
Shutter Speed : 1/120
Create Date : 2014:09:23 08:22:25.918
Date/Time Original : 2014:09:23 08:22:25.918
Thumbnail Image : (Binary data 12195 bytes, use -b option to extract)
Circle Of Confusion : 0.004 mm
Field Of View : 57.2 deg
Focal Length : 4.1 mm (35 mm equivalent: 33.0 mm)
Hyperfocal Distance : 1.89 m
Light Value : 10.1
Another option is exiv2 which is available from here and also has various library APIs available.
I have not used it and cannot endorse it, but there is also a Python interface to exiv2.
In case you wanted a hand on Python subprocesses, you do this sort of thing:
import subprocess
...
...
p = subprocess.Popen(['identify -verbose someImage.jpg'], stdout=subprocess.PIPE)
retcode = p.wait()
data = p.stdout.read()
These properties should be stored in Exif data.
In Python, see here for some code to read Exif data.
With Opencv we can able to read image type,width,height,Depth but we cant able to read other parameters related to ISo,ShutterSpeed,Brightness,Description and Date Modified,Created.
If you want to get that information you can get it using C#

Kivy - [Critical] Warning too much iteration, when drawing Ellipse

I have been struggling recently creating a filled Circle in Kivy that stays a circle when the window is re-sized to a different width or height. I looked at the question here:
Centering an object in Kivy
But when I implement my Circle like so:
<BigCircle>
width: min(self.size)
height: min(self.size)
pos_hint: {'center_x': .5, 'center_y': .5}
canvas:
Color:
rgb: 1, 1, 0
Ellipse:
size: self.size
pos: self.pos
<MainScreen>:
FloatLayout
size: root.size
canvas:
Color:
rgb: 1, 1, 1
Rectangle:
size: self.size
BigCircle:
id: big_cir
class MainScreen(Screen):
pass
class MyApp(App):
def build(self):
sm = ScreenManager(transition=NoTransition())
sm.add_widget(MainScreen(name="Main"))
return sm
I get the error:
[Critical][Clock ]Warning, too much iteration done before the next frame. Check your code, or increase the Clock.max_iteration attribute
I am doing nothing with the Clock, but I am using a ScreenManager. Currently, MainScreen is the only screen. If I change the height/width to not include the min() then it works, but that is necessary to keep the Circle circular. Otherwise it becomes elongated when re-sized and looks bad.
The problem is you have an infinite loop due to BigCircle width and height being adjusted based on its size (width, height). Try changing your BigCircle to:
<BigCircle>
canvas:
Color:
rgb: 1, 1, 0
Ellipse:
size: min(self.size), min(self.size)
pos: root.center_x - min(self.size)/2, root.center_y - min(self.size)/2

XLib windows auto-alignment performance

In XLib based application, I need to make the child window to be resized after the parent window. (For example, in order to make the child window to take the whole client area of the parent window)
I am processing the ConfigureNotify event of the parent window and resizing the child window when needed.
In generally it works properly. But there is a delay between resizing the parent window (for example when the user resizes the window dragging the edge) and the event received by the application.
Because of this delay, the child window(s) takes its proper size only some time after the user stops to move the edges. This way, some bad flicker appears on the screen and the user interface looks really sluggish.
I can see the similar behavior in many Linux programs.
How this problem can be fixed? Or at least, how to make the delay significantly smaller?
I tried to ignore some of the ConfigureNotify events by processing only the last received event and it helps a little, but not enough.
Update:
After some research I found that the problem is due to the asynchronous nature of the WM-application interaction. While the application resizes and redraws the child window, the window manager continues to resize the parent window. So, when the process of the resize/realign/redraw finishes, the parent window has another size, another event is posted to the event queue and everything must be started from the beginning.
Remove the ConfigureNotify event handling and get the current parent size in the expose processing. This ignores the queued Configure Notify events the give a history of the parent size rather that the current parent window size.
So modifying the code you posted in the comments.
if (e.type == Expose) {
if (e.xexpose.count == 0) {
Window r;
int x,y;
unsigned int wd,ht, bw, dep;
XGetGeometry(d,w,&r,&x,&y,&wd,&ht,&bw,&dep);
width = wd - 20;
height = ht - 20;
XMoveResizeWindow (d, ww, 10, 10, width, height);
for (i=0;i<1000;i++) {
XFillRectangle(d, ww, DefaultGC(d, s), 20, 20, 10, 10);
XFillRectangle(d, ww, DefaultGC(d, s), width-30, height-30, 10, 10);
XFillRectangle(d, ww, DefaultGC(d, s), 20, height-30, 10, 10);
XFillRectangle(d, ww, DefaultGC(d, s), width-30, 20, 10, 10);
}
}
}
Update: To fix the lack of expose events, add the following:
if (e.type == ConfigureNotify) {
{
while (XCheckTypedWindowEvent(d, w, ConfigureNotify, &e) == True);
width = e.xconfigure.width - 20;
height = e.xconfigure.height - 20;
XMoveResizeWindow (d, ww, 10, 10, width, height);
}
This will cause some more expose events. The XCheckTypedWindowEvent may not be necessary, it removes any all the ConfigureNotify events from the queue leaving the last one found in e.

Resources