Copy link to clipboard
Copied
I am a 4th year IT student, and for my final year project I am making an image editor application using Machine Learning. So in my project I want to include Adobe Photoshop's Add Anchor Point Tool. So can anyone help me by guiding me that how I can train my ML mode using Anchor Points? And in the final output if the user want I can show him anchor points.
Copy link to clipboard
Copied
@Aryan5C34 wrote:
... I am making an image editor application ... I want to include Adobe Photoshop's Add Anchor Point Tool.
Are you saying you want to use Photoshop's proprietary source code for an image editor application you are developing?
Or do you have a question about how to use Photoshop that we can answer?
~ Jane
Copy link to clipboard
Copied
The 1st one but with the help of ML.
Copy link to clipboard
Copied
Adobe does not publish Photoshop Code. Users here do not have access to Photoshop's source code. Have you look into Adobe's SDK for Photoshop to see it there any Api for adding control points in a path in a plug-in. I would think that would requite changing some existing control points as well as adding the control point. it would not be a simple task.
Copy link to clipboard
Copied
I don't want the exact source code. I just want to understand the concept, how they were able to make such a feature. Because I also want to create a feature like that i.e. to get the curve/anchor points, but using Machine Learning.
Copy link to clipboard
Copied
Concept? There is the math. You have a line that is possible curved any which by control points on each end some formula that determines the path line follows. To add a control point you cut the line into two lines segments there are now three control point that set the path segments two line segment now follow. The two paths segment replicates the Path the Single line's path segment had. You are changing the number of control points a path has. Your Machine Learning may want to adds a control point so it can adjust part of an existing path to follow the path of beats of a different drummer. When I add a control it is because I what to change an existing path. With my leaning I normally look for control points that I can remove to make the full curved path smoother and better. In my mine its best to make paths with as few control points as you can. It is easier to make a good circle path with four control points then circle with 10 control points. A machine may to able to precisely position and set those 10 control point my 80 year old hands can not. Photoshop is also a pixels editor with square pixels. Would 10 equally space control point land on a pixels that are squarely on the circumference. I would guess not. Why would your Machine Learning want to add control point to keep an existing path. I would think your Machine Learning would determine an existing path is not ideals would to modify it to improve its quality like I do. How your Machine Learning will do this is outside the scope of my mind. I just keep making adjustment till I have a paths I find acceptable. I do not have an automated process I use brute force.... Photoshops vector tool gives me that force..
Paths are mathematical description the line you see is the some size plot for that mathematical description paths are scalable. They need not be limited to two dimensions
Copy link to clipboard
Copied
Photoshop Path Contol points are available with Photoshop scripting.
// 2015 John J. McAssey (JJMack)
// ======================================================= */
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits;
// Set Photoshop to use pixels
app.preferences.rulerUnits = Units.PIXELS;
var thePath = selectedPath();
if (thePath == undefined) {
alert("No Path Selected");
}
else {
var myPathInfo = extractSubPathInfo(thePath);
var message =" Path Points\n";
for(var k=0;k<myPathInfo.length;k++){
for(var j=0;j<myPathInfo[k].entireSubPath.length;j++){
message = message + "P" + k + " " + j + " X " + Math.round(myPathInfo[k].entireSubPath[j].anchor[0]) + " Y " + Math.round(myPathInfo[k].entireSubPath[j].anchor[1]) + "\n";
}
}
alert(message);
}
// Return the app preferences
app.preferences.rulerUnits = startRulerUnits;
////// determine selected path //////
function selectedPath () {
try {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Path"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var theName = desc.getString(charIDToTypeID("PthN"));
return app.activeDocument.pathItems.getByName(theName)
}
catch (e) {
return undefined
}
};
////// michael l hale’s code //////
function extractSubPathInfo(pathObj){
var pathArray = new Array();// each element can be used as the second arugment in pathItems.add ie doc.pathItems.add("myPath1", [pathArray[0]]);
var pl = pathObj.subPathItems.length;
for(var s=0;s<pl;s++){
var pArray = new Array();
for(var i=0;i<pathObj.subPathItems[s].pathPoints.length;i++){
pArray[i] = new PathPointInfo;
pArray[i].kind = pathObj.subPathItems[s].pathPoints[i].kind;
pArray[i].anchor = pathObj.subPathItems[s].pathPoints[i].anchor;
//alert("Anchor " + pathObj.subPathItems[s].pathPoints[i].anchor );
pArray[i].leftDirection = pathObj.subPathItems[s].pathPoints[i].leftDirection;
pArray[i].rightDirection = pathObj.subPathItems[s].pathPoints[i].rightDirection;
};
pathArray[pathArray.length] = new Array();
pathArray[pathArray.length - 1] = new SubPathInfo();
pathArray[pathArray.length - 1].operation = pathObj.subPathItems[s].operation;
pathArray[pathArray.length - 1].closed = pathObj.subPathItems[s].closed;
pathArray[pathArray.length - 1].entireSubPath = pArray;
};
return pathArray;
};
Copy link to clipboard
Copied
See the Legal terms from Adobe:
https://www.adobe.com/legal/terms.html
3.2 Adobe Intellectual Property. We (and our licensors) remain the sole owner of all right, title, and interest in the Services and Software. Except as stated in the Terms, we do not grant you any rights to patents, copyrights, trade secrets, trademarks, or any other rights in respect to the items in the Services or Software. We reserve all rights not granted under the Terms.
6.2 Misuse. You must not misuse the Services or Software. For example, you must not:
(A) use the Services or Software without, or in violation of, a written license or agreement with Adobe;
(B) copy, modify, host, stream, sublicense, or resell the Services or Software;
(C) enable or allow others to use the Services or Software using your account information;
(D) offer, use, or permit the use of the Services or Software in a computer services business, third-party outsourcing service, on a membership or subscription basis, on a service bureau basis, on a time-sharing basis, as a part of a hosted service, or on behalf of any third party;
(E) use the Software to construct any kind of database or dataset;
(F) access or attempt to access the Services or Software by any means other than the interface we provide or authorize;
(G) circumvent any access or use restrictions put into place to prevent certain uses of the Services or Software;
(H) Share Content or Creative Cloud Customer Fonts or otherwise engage in behavior that violates anyone’s Intellectual Property Rights. “Intellectual Property Rights” means copyright, moral rights, trademark, trade dress, patent, trade secret, unfair competition, right of privacy, right of publicity, and any other proprietary rights;
(I) Share any Content that is unlawful, harmful, threatening, obscene, violent, abusive, tortious, defamatory, libelous, vulgar, lewd, profane, invasive of another’s privacy, hateful, or otherwise objectionable;
(J) Share any Content that sexualizes minors or that is intended to facilitate inappropriate interactions with minors, other Adobe users, or the public;
(K) impersonate any person or entity, or falsely state or otherwise misrepresent your affiliation with a person or entity;
(L) attempt to disable, impair, or destroy the Services or Software;
(M) upload, transmit, store, or make available any Content, Creative Cloud Customer Fonts, or code that contains any viruses, malicious code, malware, or any components designed to harm or limit the functionality of the Services or Software;
(N) disrupt, interfere with, or inhibit any other user from using the Services or Software (such as stalking, intimidation, harassment, or incitement or promotion of violence or self-harm);
(O) engage in chain letters, junk mails, pyramid schemes, phishing, spamming, fraudulent activities, or other unsolicited messages;
(P) place an advertisement of any products or services in the Services except with our prior written approval;
(Q) use any data mining or similar data gathering and extraction methods in connection with the Services or Software, including data scraping for machine learning or other purposes;
(R) artificially manipulate or disrupt the Services or Software (such as manipulating appreciations on Behance or driving users to third-party sites);
(S) create Adobe accounts for the purpose of violating these terms or for circumventing account termination or other types of actions taken by Adobe;
(T) manipulate or otherwise display the Services or Software by using framing or similar navigational technology; or
(U) violate applicable law.
~ Jane
Copy link to clipboard
Copied
These bezier curves are rooted in the core functionality that Illustrator introduced with it's very first version. Years later, this functionality carried over into PS. How bezier curves worked was linked to Postscript code, so you might want to see if you can find an old Postscript Reference Manual and bone up on the basics on how curves work there and the math involved in calculating the positions and vectors of control points. Postscript is less relevant this day and age (mostly replaced by the Portable Document Format), but would be useful in understanding the basics.
Copy link to clipboard
Copied
Brad @ Roaring Mouse wrote:
These bezier (sic) curves are rooted in the core functionality that Illustrator introduced with it's very first version.
Hi
To clarify, development of Illustrator began in 1985.
The curves were first developed years before in 1959 by Paul de Casteljau, and popularized by Pierre Étienne Bézier, French engineer, for designing automobiles when he worked for the Renault car company from 1933 to 1975.
The curves are also used in many non-Adobe applications, such as CorelDRAW, QuarkXPress, and more.
Postscript (sic) is less relevant this day and age (mostly replaced by the Portable Document Format)...
PostScript is still relevant to some of us, especially for high-end printing. 😊
~ Jane
Copy link to clipboard
Copied
I'm with ya, Jane. I know that bezier curves are/have been everywhere, I have worked with all of these programs... and I still rely (and edit) on a PostScript workflow to this day, which is why I suggested the manual.. It might give the OP an insight in how to implement their own ideas.