In the Azure Cognitive Services Face API (see e.g. https://azure.microsoft.com/en-us/services/cognitive-services/face), the following response fields never seem to trigger:
headPose:pitch (reserved field)
foreheadOccluded
eyeOccluded
Am I misusing these, or is there a plan for them, or is there no plan to activate them?
If you look at the API documentation here:
For the headPose, it says:
EDIT 13/06/2019: doc was saying
HeadPose's pitch value is a reserved field and will always return 0
Now changed to:
headPose: 3-D roll/yaw/pitch angles for face direction.
For the foreheadOccluded value, I successfully got true value in the following test, where there is a cap on the head (sorry for the sample, did not find anything else quickly!):
URL: https://westeurope.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=occlusion
Content sent: { "url": "https://www.knijff.com/markmatters/wp-content/uploads/2015/10/Trump-Red-Hat.jpg" }
Reply received:
[{
"faceId": "e6ae42a6-b008-4859-9bf5-1ae22e4b71a7",
"faceRectangle": {
"top": 118,
"left": 212,
"width": 276,
"height": 276
},
"faceAttributes": {
"occlusion": {
"foreheadOccluded": true,
"eyeOccluded": false,
"mouthOccluded": false
}
}
}]
For the eyeOccluded value, I successfully got true and false values in the following test where the same person appears 2 times, one with a rectangle over the eyes:
URL: https://westeurope.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=occlusion
Content sent: { "url": "https://jov.arvojournals.org/data/Journals/JOV/933685/i1534-7362-14-13-14-f09.png" }
Reply received (please note that 1st face is the right one):
[{
"faceId": "4c2eb52e-2fd4-456c-bdae-694df1adc571",
"faceRectangle": {
"top": 204,
"left": 683,
"width": 297,
"height": 297
},
"faceAttributes": {
"occlusion": {
"foreheadOccluded": false,
"eyeOccluded": false,
"mouthOccluded": true
}
}
}, {
"faceId": "5b9dc938-e6cf-4fe9-8e6c-8649fef44e7a",
"faceRectangle": {
"top": 213,
"left": 107,
"width": 275,
"height": 275
},
"faceAttributes": {
"occlusion": {
"foreheadOccluded": false,
"eyeOccluded": true,
"mouthOccluded": false
}
}
}]
Related
According the imgur website:
When you upload a post to Imgur, you have two post privacy options: Hidden and Public.
A hidden post means that your post is not shared with the general Imgur community and can only be accessed via the URL. Hidden posts cannot be searched,...
Using only my client id (no OAuth), I hit the gallery search endpoint using the tag '#wow' (ie GET https://api.imgur.com/3/gallery/t/wow/). I get the same results as when visiting this publicly accessible page: https://imgur.com/t/wow.
Viewing the metadata for these images that I get from my api request, almost all (56 / 60) have a privacy value of "hidden"
Could be concerning, though wondered if an imgur expert could explain this before I try contact imgur about it.
Portion of the API json response:
{"data":
{"name": "wow",
"display_name": "wow",
"followers": 29719,
"total_items": 17077,
"following": false,
"is_whitelisted": true,
"background_hash": "QL9pTeJ",
"thumbnail_hash": nil,
"accent": "159559",
"background_is_animated": false,
"thumbnail_is_animated": false,
"is_promoted": false,
"description": "",
"logo_hash": nil,
"logo_destination_url": nil,
"description_annotations": {},
"items":
[{"id": "yWPI5rf",
"title": "Lake basement.",
"description": nil,
"datetime": 1656844974,
"cover": "IrUShgg",
"cover_width": 720,
"cover_height": 960,
"account_url": "DacianFalx",
"account_id": 64529075,
"privacy": "hidden", // 56 / 60 items have the same privacy value
"layout": "blog",
"views": 50557,
"link": "https://imgur.com/a/yWPI5rf",
"ups": 481,
"downs": 6,
"points": 475,
"score": 499,
"is_album": true,
"vote": nil,
"favorite": false,
"nsfw": false,
"section": "",
"comment_count": 116,
"favorite_count": 40,
"topic": nil,
"topic_id": nil,
"images_count": 1,
"in_gallery": true,
"is_ad": false,
"tags":
[{"name": "wow",
"display_name": "wow",
"followers": 29719,
"total_items": 17076,
"following": false,
"is_whitelisted": false,
"background_hash": "QL9pTeJ",
...omitted...
Using the llrpjs library for Node.js, we are attempting to read tags from the Zebra FX7500 (Motorola?). This discussion points to the RFID Reader Software Interface Control Guide pages 142-144, but does not indicate potential values to set up the device.
From what we can gather, we should issue a SET_READER_CONFIG with a custom parameter (MotoDefaultSpec = VendorIdentifier: 161, ParameterSubtype: 102, UseDefaultSpecForAutoMode: true). Do we need to include the ROSpec and/or AccessSpec values as well (are they required)? After sending the SET_READER_CONFIG message, do we still need to send the regular LLRP messages (ADD_ROSPEC, ENABLE_ROSPEC, START_ROSPEC)? Without the MotoDefaultSpec, even after sending the regular LLRP messages, sending a GET_REPORT does not retrieve tags nor does a custom message with MOTO_GET_TAG_EVENT_REPORT. They both trigger a RO_ACCESS_REPORT event message, but the tagReportData is null.
The README file for llrpjs lists "Vendor definitions support" as a TODO item. While that is somewhat vague, is it possible that the library just hasn't implemented custom LLRP extension (messages/parameters) support, which is why none of our attempts are working? The MotoDefaultSpec parameter and MOTO_GET_TAG_EVENT_REPORT are custom to the vendor/chipset. The MOTO_GET_TAG_EVENT_REPORT custom message seems to trigger a RO_ACCESS_REPORT similar to the base LLRP GET_REPORT message, so we assume that part is working.
It is worth noting that Zebra's 123RFID Desktop setup and optimization tool connects and reads tags as expected, so the device and antenna are working (reading tags).
Could these issues be related to the ROSPEC file we are using (see below)?
{
"$schema": "https://llrpjs.github.io/schema/core/encoding/json/1.0/llrp-1x0.schema.json",
"id": 1,
"type": "ADD_ROSPEC",
"data": {
"ROSpec": {
"ROSpecID": 123,
"Priority": 1,
"CurrentState": "Disabled",
"ROBoundarySpec": {
"ROSpecStartTrigger": {
"ROSpecStartTriggerType": "Immediate"
},
"ROSpecStopTrigger": {
"ROSpecStopTriggerType": "Null",
"DurationTriggerValue": 0
}
},
"AISpec": {
"AntennaIDs": [1, 2, 3, 4],
"AISpecStopTrigger": {
"AISpecStopTriggerType": "Null",
"DurationTrigger": 0
},
"InventoryParameterSpec": {
"InventoryParameterSpecID": 1234,
"ProtocolID": "EPCGlobalClass1Gen2"
}
},
"ROReportSpec": {
"ROReportTrigger": "Upon_N_Tags_Or_End_Of_ROSpec",
"N": 1,
"TagReportContentSelector": {
"EnableROSpecID": true,
"EnableAntennaID": true,
"EnableFirstSeenTimestamp": true,
"EnableLastSeenTimestamp": true,
"EnableSpecIndex": false,
"EnableInventoryParameterSpecID": false,
"EnableChannelIndex": false,
"EnablePeakRSSI": false,
"EnableTagSeenCount": true,
"EnableAccessSpecID": false
}
}
}
}
}
For anyone having a similar issue, we found that attempting to configure more antennas than the Zebra device has connected caused the entire spec to fail. In our case, we had two antennas connected, so including antennas 3 and 4 in the spec was causing the problem.
See below for the working ROSPEC. The extra antennas in the data.AISpec.AntennaIDs property were removed and allowed our application to connect and read tags.
We are still having some issues with llrpjs when trying to STOP_ROSPEC because it sends an RO_ACCESS_REPORT response without a resName value. See the issue on GitHub for more information.
That said, our application works without sending the STOP_ROSPEC command.
{
"$schema": "https://llrpjs.github.io/schema/core/encoding/json/1.0/llrp-1x0.schema.json",
"id": 1,
"type": "ADD_ROSPEC",
"data": {
"ROSpec": {
"ROSpecID": 123,
"Priority": 1,
"CurrentState": "Disabled",
"ROBoundarySpec": {
"ROSpecStartTrigger": {
"ROSpecStartTriggerType": "Null"
},
"ROSpecStopTrigger": {
"ROSpecStopTriggerType": "Null",
"DurationTriggerValue": 0
}
},
"AISpec": {
"AntennaIDs": [1, 2],
"AISpecStopTrigger": {
"AISpecStopTriggerType": "Null",
"DurationTrigger": 0
},
"InventoryParameterSpec": {
"InventoryParameterSpecID": 1234,
"ProtocolID": "EPCGlobalClass1Gen2",
"AntennaConfiguration": {
"AntennaID": 1,
"RFReceiver": {
"ReceiverSensitivity": 0
},
"RFTransmitter": {
"HopTableID": 1,
"ChannelIndex": 1,
"TransmitPower": 170
},
"C1G2InventoryCommand": {
"TagInventoryStateAware": false,
"C1G2RFControl": {
"ModeIndex": 23,
"Tari": 0
},
"C1G2SingulationControl": {
"Session": 1,
"TagPopulation": 32,
"TagTransitTime": 0,
"C1G2TagInventoryStateAwareSingulationAction": {
"I": "State_A",
"S": "SL"
}
}
}
}
}
},
"ROReportSpec": {
"ROReportTrigger": "Upon_N_Tags_Or_End_Of_AISpec",
"N": 1,
"TagReportContentSelector": {
"EnableROSpecID": true,
"EnableAntennaID": true,
"EnableFirstSeenTimestamp": true,
"EnableLastSeenTimestamp": true,
"EnableTagSeenCount": true,
"EnableSpecIndex": false,
"EnableInventoryParameterSpecID": false,
"EnableChannelIndex": false,
"EnablePeakRSSI": false,
"EnableAccessSpecID": false
}
}
}
}
}
How can I give a phaser 3 matter body an animation? Ideally I would like to switch between several animations.
So far I have only managed to give it a static image:
function preload ()
{
this.load.image('human', 'assets/sprites/x2kship.png');
}
function create ()
{
human = this.matter.add.sprite(300, 400, 'human');
}
I do have prepared files from an old project: atlas.png, atlas.json, animations.json. And it loads successfully:
this.load.atlas('sheet', 'data/atlas.png', 'data/atlas.json');
An example from the animations.json:
{
"animations": [
{
"name": "human-walk",
"frames": [
"human1.png",
"human2.png",
"human3.png",
"human4.png"
],
"frameRate": 100
},
...
The referenced files "human1.png" etc are found in the atlas.json:
"human1.png": {
"frame": { "x": 1137,"y": 1030, "w": 182, "h": 195 },
"rotated": false,
"trimmed": false,
"spriteSourceSize": { "x": 0,"y": 0, "w": 182, "h": 195 },
"sourceSize": { "w": 182, "h": 195 },
"pivot": { "x": 0.5, "y": 0.5 }
},
How can i stich these parts together to make the human do something like human.animations.play('human-walk')? And then maybe human.animations.play('human-stand-still')?
Tweeking the animations format I got it to work like this:
function preload ()
{
this.load.image('human', 'assets/sprites/x2kship.png');
this.load.atlas('sheet', 'data/atlas.png', 'data/atlas.json');
}
function create ()
{
var humanWalk = {
key: 'human-walk',
frames: [
{key: "sheet", frame: "human1.png"},
{key: "sheet", frame: "human2.png"},
{key: "sheet", frame: "human3.png"},
{key: "sheet", frame: "human4.png"},
],
frameRate: 6,
repeat: -1
};
this.anims.create(humanWalk);
human = this.matter.add.sprite(100, 100, 'human');
human.anims.load('human-walk');
human.anims.play('human-walk');
}
Is there any possible way to fetch the live availability of host/host group from Nagios monitoring tool (where host/hostgroups are already configured) which can be redirected/captured to an external webpage.
are there any exposed API's to do that, couldn't found a way.
Nagios is on a Linux host.
Any help or info is appreciated.
EDIT1:
I have a hostgroup say for example 'All_prod' in this hostgroup I will be having around 20 linux hosts for all the host there would be some metrics/checks defined (example availability, cpu load, free memory ..etc). Here I want the report of only availability metrics of all the host(example : lets say if in 24 hours if the availability is down for 10 minutes then it should provide me with the report as it was down for 10 minutes in 24 hours or just give me any related info which i can evaluate using data evaluation).
it would be great if there are any API's to fetch that information, which will return the data as json/xml.
You can use the Nagios JSON API. You can use the query builder here http://NAGIOSURL/jsonquery.html.
But, to answer your specific question, the queries for hosts would look like this:
http://NAGIOSURL/cgi-bin/statusjson.cgi?query=host&hostname=localhost
Which will output something similar to the following:
{
"format_version": 0,
"result": {
"query_time": 1497384499000,
"cgi": "statusjson.cgi",
"user": "nagiosadmin",
"query": "host",
"query_status": "released",
"program_start": 1497368240000,
"last_data_update": 1497384489000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"host": {
"name": "localhost",
"plugin_output": "egsdda",
"long_plugin_output": "",
"perf_data": "",
"status": 8,
"last_update": 1497384489000,
"has_been_checked": true,
"should_be_scheduled": false,
"current_attempt": 10,
"max_attempts": 10,
"last_check": 1496158536000,
"next_check": 0,
"check_options": 0,
"check_type": 1,
"last_state_change": 1496158536000,
"last_hard_state_change": 1496158536000,
"last_hard_state": 1,
"last_time_up": 1496158009000,
"last_time_down": 1496158536000,
"last_time_unreachable": 1480459504000,
"state_type": 1,
"last_notification": 1496158536000,
"next_notification": 1496165736000,
"no_more_notifications": false,
"notifications_enabled": true,
"problem_has_been_acknowledged": false,
"acknowledgement_type": 0,
"current_notification_number": 2,
"accept_passive_checks": true,
"event_handler_enabled": true,
"checks_enabled": false,
"flap_detection_enabled": true,
"is_flapping": false,
"percent_state_change": 0,
"latency": 0.49,
"execution_time": 0,
"scheduled_downtime_depth": 0,
"process_performance_data": true,
"obsess": true
}
}
}
And for hostgroups:
http://NAGIOSURL/nagios/cgi-bin/statusjson.cgi?query=hostlist&hostgroup=linux-servers
Which will output something similar to the following:
{
"format_version": 0,
"result": {
"query_time": 1497384613000,
"cgi": "statusjson.cgi",
"user": "nagiosadmin",
"query": "hostlist",
"query_status": "released",
"program_start": 1497368240000,
"last_data_update": 1497384609000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"selectors": {
"hostgroup": "linux-servers"
},
"hostlist": {
"localhost": 8
}
}
}
Hope this helps!
EDIT 1 (To correspond with the question's EDIT 1):
What you're asking for isn't built in by default. You can use the above methods to grab the data for each host (but it sounds like you want it for each service), so again we will use the JSON API found at http://YOURNAGIOSURL/jsonquery.html to grab service data..
http://YOURNAGIOSURL/nagios/cgi-bin/statusjson.cgi?query=service&hostname=localhost&servicedescription=Current+Load
We'll get the following output (something similar, anyway):
{
"format_version": 0,
"result": {
"query_time": 1497875258000,
"cgi": "statusjson.cgi",
"user": "nagiosadmin",
"query": "service",
"query_status": "released",
"program_start": 1497800686000,
"last_data_update": 1497875255000,
"type_code": 0,
"type_text": "Success",
"message": ""
},
"data": {
"service": {
"host_name": "localhost",
"description": "Current Load",
"plugin_output": "OK - load average: 0.00, 0.00, 0.00",
"long_plugin_output": "",
"perf_data": "load1=0.000;5.000;10.000;0; load5=0.000;4.000;6.000;0; load15=0.000;3.000;4.000;0;",
"max_attempts": 4,
"current_attempt": 1,
"status": 2,
"last_update": 1497875255000,
"has_been_checked": true,
"should_be_scheduled": true,
"last_check": 1497875014000,
"check_options": 0,
"check_type": 0,
"checks_enabled": true,
"last_state_change": 1497019191000,
"last_hard_state_change": 1497019191000,
"last_hard_state": 0,
"last_time_ok": 1497875014000,
"last_time_warning": 1497019191000,
"last_time_unknown": 0,
"last_time_critical": 1497018891000,
"state_type": 1,
"last_notification": 0,
"next_notification": 0,
"next_check": 1497875314000,
"no_more_notifications": false,
"notifications_enabled": true,
"problem_has_been_acknowledged": false,
"acknowledgement_type": 0,
"current_notification_number": 0,
"accept_passive_checks": true,
"event_handler_enabled": true,
"flap_detection_enabled": true,
"is_flapping": false,
"percent_state_change": 0,
"latency": 0,
"execution_time": 0,
"scheduled_downtime_depth": 0,
"process_performance_data": true,
"obsess": true
}
}
}
The most important line for what you're trying to do (as far as I understand it) is the perfdata line:
"perf_data": "load1=0.000;5.000;10.000;0; load5=0.000;4.000;6.000;0; load15=0.000;3.000;4.000;0;",
This is the data you'd use to generate whatever custom metrics report you're trying to generate.
Keep in mind this is something that is sort of built in to Nagios XI (not in an exportable format like you're requesting) but the metrics component does allow you to easily drill down and take a look at some metric specific data.
Hope this helps!
I am using Diffbot's article API for scraping the articles from any site.
Currently I am getting articles with single image, but I want to scrape all the images for the particular article.
Any suggestion will be appreciated.
The Article API should, by default, grab all the images in an article. Here's what I get in the "images" array when I run the Article API on this post:
"images": [
{
"pixelHeight": 106,
"diffbotUri": "image|3|-317133287",
"primary": true,
"pixelWidth": 474,
"url": "http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2014/09/1410897265phpstormlogo.jpg"
},
{
"pixelHeight": 375,
"diffbotUri": "image|3|-2098856075",
"pixelWidth": 500,
"url": "http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2014/09/1410897372Spear_point_knife_blade.jpg"
},
{
"pixelHeight": 525,
"diffbotUri": "image|3|-878345903",
"pixelWidth": 700,
"url": "http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2014/09/1410897486CXM-Framework.jpg"
},
{
"pixelHeight": 375,
"diffbotUri": "image|3|-1729707743",
"pixelWidth": 500,
"url": "http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2014/09/1410897666Fotolia_57724999_Subscription_Monthly_S.jpg"
},
{
"pixelHeight": 360,
"diffbotUri": "image|3|805836010",
"pixelWidth": 320,
"url": "http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2014/09/1410897716cordova_bot.png"
}
],
If you're not getting the same results for a URL, you can always define a custom ruleset that'll grab them. I wrote some tutorials on extracting repeated data here, and there are some hints here, too.
Can you give us the URL of the article that makes the API fail to return all images? Maybe we can solve the problem together by looking at the source of the issue.